bb.donnay-software.com

Donnay Software Web Forums
It is currently Mon May 20, 2019 6:05 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Mar 04, 2019 3:02 pm 
Offline

Joined: Sat Mar 20, 2010 8:36 am
Posts: 109
Location: Cerklje
Dear Roger,

I would like to filter array with content of variable cMAt which is a result of DCSLE. Bellow is the ilustration of my intentions, of course, it is not working in presented form.

Code:
LOCAL bFlt:={|a| (alltrim(upper(cMat))) $ a[2]}

@0,0 DCSLE cMat SIZE 30,1  DATALINK {||oBrowse:refreshAll()}
 
@ 2,0 DCBROWSE oBrowse DATA arr SIZE 100,25 ;
      PRESENTATION dc_BrowPres()  FIT     FILTER bFlt

…..
…..


Any hint appreciated.
BR Janko


Top
 Profile  
 
PostPosted: Mon Mar 04, 2019 4:34 pm 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3902
Location: Boise, Idaho USA
Put some debugging in your code block to see the data as it is being evaluated :

The debug window will show the contents of a[2] and x for each row of the browse.

Code:
LOCAL bFlt:={|a,x| x := (alltrim(upper(cMat))), (wtf x,a[2]), x $ a[2]}

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Tue Mar 05, 2019 3:07 am 
Offline

Joined: Sat Mar 20, 2010 8:36 am
Posts: 109
Location: Cerklje
Dear Roger,

I've prepared a small demo. Without FILTER it Works normal, after involving FILTER in DCBROWSE an error is generated
but I can not localize it.

I'd appreciate your suggestions.

BE Janko


Attachments:
rogerFLT.zip [30.34 KiB]
Downloaded 31 times
Top
 Profile  
 
PostPosted: Tue Mar 05, 2019 7:41 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3902
Location: Boise, Idaho USA
I am still trying to figure out why it errors when cMat is initialized to an empty value.

I will work on this today.

A workaround for you is to initialize cMat := 'A'

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Tue Mar 05, 2019 7:50 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3902
Location: Boise, Idaho USA
Here is a fix that will work for you:

Code:
LOCAL bFlt:={|a,x| x := (alltrim(upper(cMat))), Empty(x) .OR. x $ a[2]}

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Tue Mar 05, 2019 9:59 pm 
Offline

Joined: Sat Mar 20, 2010 8:36 am
Posts: 109
Location: Cerklje
Dear Roger,

yes, the solution is logical and it works.

I would ask you also for an advice: how to refresh (repaint) oBrowse after each key stroke.
WHEN clause, DATALINK only do it after changin focus to oBrowse. I need refreshing after any change of cMat.

Thanks in advance
Janko


Top
 Profile  
 
PostPosted: Wed Mar 06, 2019 5:53 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3902
Location: Boise, Idaho USA
This code prevents an error if the data entered in the DCGET is not found in the array.

Code:
cMat := Space(30)
 @0,0 DCGET cMat PICTURE '@!' ;
    KEYBLOCK {|n,x,o|o:GetData(),FilterBrowse(n,oBrowse,arr,cMat,o)}


STATIC FUNCTION FilterBrowse( nKey, oBrowse, arr, cMat, oGet )

LOCAL nFound := AScan(arr,{|a|Alltrim(cMat) $ a[2]}), lStatus := .t.

IF nKey < 97 .OR. nKey > 122  // A-Z
  RETURN .t.
ENDIF

IF nFound > 0 .AND. !Empty(cMat)
  oBrowse:goTop()
  oBrowse:forceStable()
  oBrowse:refreshAll()
ELSE
  lStatus := .f.
ENDIF

RETURN lStatus

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Wed Mar 06, 2019 10:42 am 
Offline

Joined: Sat Mar 20, 2010 8:36 am
Posts: 109
Location: Cerklje
Dear Roger,
yes, yes it works perfect. Thank you very much.

Kind regards
Janko


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group