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

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

Postby lucasdebeltran » Wed Mar 14, 2012 1:41 pm

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.
Last edited by lucasdebeltran on Thu Mar 15, 2012 4:38 pm, edited 1 time in total.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

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

Postby lucasdebeltran » Thu Mar 15, 2012 4:36 pm

UP-.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

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

Postby reinaldocrespo » Fri Mar 16, 2012 7:50 pm

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.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

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

Postby lucasdebeltran » Fri Mar 16, 2012 8:35 pm

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.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

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

Postby lucasdebeltran » Tue Mar 20, 2012 7:48 am

up.-
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

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

Postby frose » Tue Mar 20, 2012 9:37 am

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
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests