Subject Re: [IBO] programatically setting search-criteria
Author Geoff Worboys
> Thanx.....writesearch and readsearch work for me.
> Isn't there a way to acess the fields of a query
> directly, as it would save me lots of parsing and
> string-formatting work?

The search criteria are actually stored in the datalinks and NOT in a
column buffer (since there is no actual row in existance during search
mode).


> What does the CTL stand for? It seems to be fix for
> any query in every application. Perhaps Jason would
> like to explain....

In "normal" interactive mode each control (using its own FieldDataLink
instance) places its defined search criteria into the dataset by name
using the following code...

if not Assigned( Control ) then
Result := ''
else if not Assigned( Control.Owner ) then
Result := 'CTL.' + Control.Name
else
Result := 'CTL.' + Control.Owner.Name + '.' + Control.Name;


So 'CTL.' is just a literal to indicate reference to a module.control
by name. To build the search criteria programmatically you must use
the same format in your entries.

If you had built your own datalink you could use a different
mechanism. Indeed depending on your circumstances you could do
exactly that. Create your own datalink (overriding the
GetSearchEntryName and DoPrepareSQL according to your own
requirements) and then instantiate datalink(s) on your form.

I have not tried this, but if you study IB_FieldDataLink.pas (and how
it uses SearchBuffer) I suspect there may be a way you can setup your
own search criteria that does not involve reference to control
instances.


Maybe this gives you some ideas?

Geoff Worboys
Telesis Computing