Subject Walking entire dataset
Author Bob
I'm looking for some advice re: how to search an entire dataset of invoices
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
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'];

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 done
but don't know what's appropriate. What's the best approach?