Subject Re: [IBO] Screen Refresh after changing SQLWhere clause to slow
Author Daniel Rail
Hi,

At June 26, 2005, 05:35, Frank wrote:

> I use a TIB_Query to access a table where I store two kind of
> informations - normal products and spareparts data.

> in my application I use a TpageControl to display them
> separated but on a single form anyway.

> Switching the Tabs between Spareparts and Products I have to
> change the SQLWhere clause like

> iqProducts.SQLWhere.Text := 'WHERE PRODUCTS.PRODUCT_TYP=''SPT''';

> To immediately refresh the screen and show the new data I have to

> iqProducts.Prepare;
> iqProducts.FetchAll;
> iqProducts.Next;

> The problem is that this way is quit slow -
> but without the FetchAll my screen will not be updated !

> How can I refresh the screen data more faster after
> changing the SQLWhere clause ?

Try this:

iqProducts.Close;
iqProducts.InvalidateSQL;
iqProducts.Open;

And, in the iqProducts OnPrepareSQL event, put something like this:

if Tab="Spare Parts" then {Change this line accordingly for your code}
iqProducts.SQLWhereItems.Add('PRODUCTS.PRODUCT_TYP=''SPT''');

I'm just assuming "SPT" means spare parts.

That's where I change the WHERE clause, and actually that where you
should be adding to it. Also, everytime InvalidateSQL is called, the
SQLWhereItems property is cleared. And, you can only add to the
SQLWhereItems in the OnPrepareSQL event.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)