[DUG] Searching ClientDataSet using locate

John Bird johnkbird at paradise.net.nz
Thu Nov 6 15:37:41 NZDT 2008


I am trying to make a generalised routine for searching a client dataset (it
searches alpha fields matching a user supplied string and positions on the
next matching record).

So far I am doing this using the locate command like:

   if
cdsFind.locate(FindFieldName,FindString,[loPartialKey,loCaseInsensitive])
then


2 questions:

Q1 - loPartialKey matches from the beginning of the alpha field text,  is
there anyway   to search anywhere within the alpha field not just match at
the begininng?

Q2 - I would like to do the locate on several alpha fields - having trouble
getting the locate sysntax to work for several fields (variant arrays).   I
have examples how to do it locating one of several constant strings (using
VarArrayOf to make the second parameter as a variant array), but not for one
string that is in a variable.  Does anyonehave a working example of locate
on multiple fields finding contents of a string variable.

Notes:

-When I get this working happy to share it

- I have to do this with something like locate that doesn't change the recno
until done, as the scroll event is slow for some datasets I want to use it
on.



John



More information about the Delphi mailing list