Subject Re: Understanding SQLWereItems
Author Marco Menardi <mmenaz@lycosmail.com>
Well, it's removed automatically. Every time you enter the PrepareSQL
event (when query has to be prepared or the SQL code is invalid, like
after Unprepare or InvalidateSQL), you just have to add the
(additional) where caluse you want, usually with code that checks some
global variable or interface status and then decides what condition to
integrate.
If your SQL code in the query already has "where" condition, with
SQLWhereItems you "integrate" them.
like
if (UserStatus = 'A') then
SQLWhereItems.Add('MORTCAGE < 1000')
else if (UserStatus = 'W') then
begin
SQLWhereItems.Add('NAME > ' + '''+ CustomerName + ''');
SQLWhereItems.Add('ADDRESSS > ' + '''+ CustomerAddress + ''');
end;

or something like this. The above, with 'W' status, adds a where
clause like:
AND (NAME > 'JOHN')
AND (ADDRESS > 'CARNABY STREET')

seel GSG if you also have to add OR conditions

you can add an SQLMonitor component and watch the query sent to the
server when you change your SLQ select and you add different
SQLWhereItems.
regards
Marco Menardi

--- In IBObjects@yahoogroups.com, "Florian Hector" <FHector@w...> wrote:
> Hi All,
>
> I have a little problem understanding the usage of SQLWhereItems.
From what
> I found in the Getting Started Help file and here on the list I
understand
> that it can use only be used in the PrepareSQL event, which I cannot
change
> dynamically at runtime. How can I add and later remove a completely new
> WHERE clause at runtime?
>
> Florian