Subject | Calculate Fields |
---|---|
Author | Andrei Luís |
Post date | 2005-06-30T19:49:07Z |
As Helen asked, I'm posting here my question about the subject:
I need to calculate a total at a sales table, at client.
I look at Helen example (calcfields.zip), but it doesn't calculate
while qrSales.State = dssInsert.
I found at messages repository, some messages about this, and one of
them, says to call OnCalculateField event when it is needed, so, I can
call it at edit OnExit event that receive qty and price values, but
I'm having difficulty on doing that. Where I get the ARow and AField
parameters?
I have configured qrSales like that:
qrSales.CalculatedFields:=TTOTAL Numeric(12,2)
procedure TDM.qrSalesCalculateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);
begin
if AField.FieldName = 'TTOTAL' then
with ARow do
begin
ByName('TTOTAL').AsCurrency :=
ByName('QTY').AsCurrency*
ByName('PRICE').AsCurrency;
end;
end;
Thanks in advance,
Andrei
I need to calculate a total at a sales table, at client.
I look at Helen example (calcfields.zip), but it doesn't calculate
while qrSales.State = dssInsert.
I found at messages repository, some messages about this, and one of
them, says to call OnCalculateField event when it is needed, so, I can
call it at edit OnExit event that receive qty and price values, but
I'm having difficulty on doing that. Where I get the ARow and AField
parameters?
I have configured qrSales like that:
qrSales.CalculatedFields:=TTOTAL Numeric(12,2)
procedure TDM.qrSalesCalculateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);
begin
if AField.FieldName = 'TTOTAL' then
with ARow do
begin
ByName('TTOTAL').AsCurrency :=
ByName('QTY').AsCurrency*
ByName('PRICE').AsCurrency;
end;
end;
Thanks in advance,
Andrei