Subject | Calculated Field, need previous row |
---|---|
Author | Bob |
Post date | 2002-06-04T15:50:34Z |
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);
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);