Subject Re: [IBO] SQLWhereItems.Add only inside OnPrepare?
Author Jason Wharton
I will only support modifications of this nature during the OnPrepareSQL
phase. To do anything else just goes back to the confusion of SQL clean-up.
Let the way it is grow on you a little more and you will see the sense in it
being the way it is even if you can't put the code all in one little tidy
spot.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: <mmenaz@...>
To: <IBObjects@yahoogroups.com>
Sent: Saturday, March 24, 2001 10:32 AM
Subject: [IBO] SQLWhereItems.Add only inside OnPrepare?


> Hi, I'm using SQLWhereItems to change query conditions at runtime.
> After some experiments, I've found that the only place where put the
> SQLWhereItems.Add('condition') is in the OnPrepare event of the query.
> So my program has a button that, once pressed, does:
> InvalidateSQL;
> Refresh;
> First;
> and in the OnPrepare are set the query SQL conditions.
>
> It would useful to me if, instead, would be possible to set these
> conditions outside the OnPrepare, so I could have, for instance, 3
> buttons with different conditions, or programmatically use different
> conditions in the program flow without the need of a global variable
> to make OnPrepare aware of what condition I need. Is it possible? I
> mean something like:
> Button1.Click()
> begin
> InvalidateSQL;
> SQLWhereItems.Add('condition1')
> SQLWhereItems.Add('condition2')
> Refresh;
> First;
> end;
>
> Thanks
>
> Marco Menardi