Subject Re: [IBO] How do search at runtime?
Author Marco Menardi
--- In, "Jason Wharton" <jwharton@i...> wrote:
> You simply make use of the OnPrepareSQL event.

My general need prevents me from doing so. I can't access the event
handler from the form, and I don't want since it's a form that is
created at runtime and a datasource is set to work on.
The form does not need to know where the dataset is taken from.

> You may want to make use of the same routines that the controls use for
> parsing and integrating the search criteria. I suggest you trace
into the
> handling of the SearchBuffer of the data links when IBO is going
through the
> OnPrepareSQL event processing. This will show you methods and
routines you
> can take advantage of if need be.

I've done and found the IB_Parse.pas and ExtractWhereClause().
The problem is that can be used only inside the OnPrepareSQL, since it
modifies SQLWhereItems, but as expleinded I can't.
I thought that searchbuffer was a TIB_Column property, while I've
discovered that is a TIB_FieldDataLink, so can't be used without
referring to "visual" controls, that I don't want to.

> In most cases it is as simple as making controls 'search aware' as I
> the toggle button in the Contact sample application. There is a fair
> written about making things 'search aware' in the archives too.

Toggle button? I've not found it.
I make heavy use of search capabilities of IBO controls, I love them.
Sometime it's convenient have the possibility to "pre fill" search
buffer at runtime, but I've seen that can't be done with regards of
the dataset, since it's a control stuff, so you need to know the name
/ location of the controls that will be used.
As I told, I was looking for something like:
With qryCustomer do
SearchBuffer.FieldByName('NAME').AsString := 'Marco';

anyway, thanks a lot
Marco Menardi

> Regards,
> Jason Wharton
> CPS - Mesa AZ
> -- We may not have it all together --
> -- But together we have it all --
> ----- Original Message -----
> From: "Marco Menardi" <mmenaz@l...>
> To: <>
> Sent: Sunday, March 16, 2003 3:36 PM
> Subject: [IBO] How do search at runtime?
> > Hi, with IB_Query in search state, I want to fill the fields with
> > values and then perform the search programmatially (runtime).
> > I've found that WriteSearch() and ReadSearch() are useless, since they
> > refer to Controls (like CTL.frmContact.EditLASTNAME=Shmit), not
> > FieldName=FieldValue (as should be CUSTOMER.LASTNAME='Shmit').
> > Assigning with FieldByName('LASTNAME') does not work too, since when
> > the IB_Query is in search state, the normal field buffer is not used.
> > How can I do?
> > I want something like
> > With qryCustomer do
> > Begin
> > Search;
> > FieldByName('NAME').AsString := 'Marco';
> > First;
> > End;
> > Or something like with stringlist syntax...
> > Regards
> > Marco Menardi