Function for a sensitive search

This forum is for eXpress++ general support.
Post Reply
Message
Author
Diego Euri Almanzar
Posts: 181
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Function for a sensitive search

#1 Post by Diego Euri Almanzar »

Hello, dear friends.

I would like to use DC_FINDBROWSE() or any other Express function for a sensitive search. I notice that when I use DC_FINDBROW(), the search is performed using the first positions of the text or field. However, the searched character is often not at the beginning of the text. It could be in the middle, or at the end, etc.

Would it be possible to use Express or Xbase++ for a search that returns the largest number of results, regardless of the position of the searched character?

For example:

White Eagle of the North

If I type "of the" with DC_FINDBROWSE(), I don't get any results. And I would like the result to be White Eagle of the North, because "of the" is contained in the field.

I would appreciate your help.

Best regards.

Wolfgang Ciriack
Posts: 492
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Function for a sensitive search

#2 Post by Wolfgang Ciriack »

Hello,

you can use the DC_BrowseAutoSeek function with:

Code: Select all

   without ADS:   bSeekBlock := {|a|  ordwildseek("*"+alltrim(upper(a))+"*"), DC_GetRefresh(oBtWs), .T.}
   with ADS:      bSeekBlock := {|a| cfilter := "{|| contains(<your dbf fieldname>,'*"+a+"*'),'*"+a+"*')}", bfilter := &cfilter, ;
         	                                    (sel)->(DbSetFilter(bfilter)), (sel)->(DbGoTop()), DC_GetRefresh(oBtWs), .T.}

   @1,20 DCSAY "Suche:" GET Suchstr  PICTURE "@K !!!!!!!!!!!!" ;
         KEYBLOCK {|a, b, o| DC_BrowseAutoSeek(a, o, oBrowse, , , , , 0.01, bSeekBlock, , .T.)} ;
         TABSTOP ;
         GETOBJECT oSuch ;
         GETID "IDSUCH" ;
         SAYRIGHT

   @2.5, 1 DCBROWSE oBrowse SIZE 40, 20 ;
        DATA cAlias ;
        .......
without ADS you can add a button "continue search" which only do a ACTION {|| OrdWildSeek(), oBrowse:RefreshAll()}
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4854
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Function for a sensitive search

#3 Post by rdonnay »

I recommend looking at \exp20\samples\browsequery\browsequery.prg.

This uses wildcards and DC_SetScopeArray().
The eXpress train is coming - and it has more cars.

Diego Euri Almanzar
Posts: 181
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: Function for a sensitive search

#4 Post by Diego Euri Almanzar »

Hello, Wolfgang Ciriack, rdonnay,

Very interesting.

Thank you.

Post Reply