Page 1 of 1

ADS not supports hb_WildMatch( '"+cWild+"', DbRecordInfo

PostPosted: Wed Mar 14, 2012 1:41 pm
by lucasdebeltran
Hello,

I use in DBFCDX this way to filter for all fields:

cWild := "*"+ "value to search A BUSCAR" +"*"
cFiltro := "hb_WildMatch( '"+cWild+"', DbRecordInfo( 9 ) ) .OR.
hb_WildMatch( '"+UPPER(cWild)+"', DbRecordInfo( 9 ) ) .or. hb_WildMatch(
'"+lower(cWild)+"', DbRecordInfo( 9 ) ) "


SET FILTER TO &cFiltro



It runs very well.

But ADS does not support it.



I tried with no luck:

cName := "LUCAS"
cExpr1 := 'contains( *, "*'+UPPER( alltrim(cName) )+'*" ) '

AdsSetAOF( cExpr1 )


Any clue please?.

Thank you very much.

Re: ADS hb_WildMatch( '"+cWild+"', DbRecordInfo

PostPosted: Thu Mar 15, 2012 4:36 pm
by lucasdebeltran
UP-.

Re: ADS not supports hb_WildMatch( '"+cWild+"', DbRecordInfo

PostPosted: Fri Mar 16, 2012 7:50 pm
by reinaldocrespo
1. You could try using the like operator with ADS.
2. Contains works perfectly if you create an FTS index on the fields where the search is to happen. No need for wild cards. Contains already searches the whole field (great for memo fields).

(cAlias)->( AdsSetAof( "contains( field, 'text' )" ) )

or

cText := "Texto"

(cAlias)->( AdsSetAof( "contains ( field,' " + ALLTRIM( cText ) + " ' ) " ) )

Notice the use of the single quotation marks and there is no blank spaces between the single and double quotation marks.

This will work with or without an FTS index, but it is simply much faster with it.

Reinaldo.

Re: ADS not supports hb_WildMatch( '"+cWild+"', DbRecordInfo

PostPosted: Fri Mar 16, 2012 8:35 pm
by lucasdebeltran
Reinaldo,

Thank you very much for helping me.

Yes, I at news.advantage they told be the function Contains.

In a single field works very good.

But not for all fields.

They told me to use *
AdsSetAof( "contains( *, 'text' )" )

But does not filter anything.


How do you create a FTS index for all fields of a DBF?.


Thank you very much.

Re: ADS not supports hb_WildMatch( '"+cWild+"', DbRecordInfo

PostPosted: Tue Mar 20, 2012 7:48 am
by lucasdebeltran
up.-

Re: ADS not supports hb_WildMatch( '"+cWild+"', DbRecordInfo

PostPosted: Tue Mar 20, 2012 9:37 am
by frose
Lucas,

depending on the ADS version, the search in all fields by using the asterisk * is combined with the AND operator, so the chance to find suitable data sets might be very low!

For example, I'm using constructs like this
Code: Select all  Expand view
contains( dbtrn->Name1, "cPattern" ) OR contains( dbtrn->Name2, "cPattern" ) OR contains( dbtrn->Name3, "cPattern" ) OR contains( dbtrn->Pst_str, "cPattern" ) OR contains( dbtrn->Ort, "cPattern" ) OR contains( dbtrn->Bmrkng,  "cPattern" ) OR contains( dbtrn->Telefon, "cPattern" ) OR contains( dbtrn->Telefax, "cPattern" )
for searching in our address table.

HTH