Subject Re: [IBO] Calculated Field, need previous row
Author Jason Wharton
Use a select procedure and make a column in the dataset which represents the
previous records value right in the same record it is needed in.

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


----- Original Message -----
From: "Bob" <rcmiszuk@...>
Newsgroups: egroups.ibobjects
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, June 04, 2002 8:50 AM
Subject: [IBO] Calculated Field, need previous row


> I have a CalculateField event that I use to populate a calculated field in
a
> dataset which is displayed in a TIB_Grid. The calculations for one of the
> columns depends on the value of that column in the previous row. I don't
> know how to make that work, for two reasons:
>
> 1. I'm not sure that I can access the previous row in the CalculatedField
> routine. I have a TIB_Statement, TIB_Row, and TIB_Column. Can I get to the
> previous row?
>
> 2. I thought I could use a temp variable to store the previous row's
> calculation, but I'm not exactly sure that I can be guaranteed that the
> CalculateField will execute sequentially, row by row, as the user scrolls
> through the grid. Does it? I've seen at times where the Calculate is fired
> only to recalc the line the user is on. This ruins my idea of a temp
> variable.
>
> The user is not allowed to change the sort order, insert, or delete, so I
> don't have to worry about all that. Mainly I need to go through the
dataset
> in order and assign the values for this calculated column, then display
that
> column in the grid along with the other columns from the dataset.
>
> Any advice is appreciated. Thanks.
>
> Bob.
>
>
> procedure TfrmHedgeReport.qrHedgeCalculateField(Sender: TIB_Statement;
> ARow: TIB_Row; AField: TIB_Column);