Subject Re: [IBO] Walking entire dataset
Author Artur Anjos

The best way to do this is doing at the server, not at the client side.
Create a SP in the server that returns just the info you want.

If you need some help for doing that SP feel free to contact me.


----- Original Message -----
From: "Bob" <rcmiszuk@...>
Newsgroups: egroups.ibobjects
To: <>
Sent: Thursday, April 18, 2002 6:40 PM
Subject: [IBO] Walking entire dataset

> I'm looking for some advice re: how to search an entire dataset of
> and perform some calculations. I know I can use a TIB_Query to fetch the
> invoice table sorted by invoice date, and then walk through it (using
> qrInvoice.Next) building my subtotals for each day's sales as I go, and
> keeping track of when the date changes, something like this:
> with qrInvoice do begin
> Open;
> First;
> while not eof do begin
> if LastDate <> qrInvoice['INV_DATE'] then begin
> DisplaySubTotal(LastDate, SubTotal);
> SubTotal := qrInvoice['AMOUNT'];
> LastDate := qrInvoice['INV_DATE'];
> end else
> SubTotal := SubTotal + qrInvoice['AMOUNT'];
> Next;
> end;
> end;
> My question is this: Is there a smarter (read "faster") way to do this? I
> fear that this might take a long time to execute. I'm still figuring out
> IBObjects and have also considered Filters or SQLWhereItems to get this
> but don't know what's appropriate. What's the best approach?
> Thanks.
> Bob.