Re: Calculated Fields Question for the pros


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]

Posted by WAllison on January 29, 19103 at 22:34:50:

In Reply to: Calculated Fields Question for the pros posted by Peterson on January 28, 19103 at 21:08:51:

: I have a small problem;

: I have two databases (paradox)

: Currency fields in one and a number fields in the other.

: I am creating a Calculated field based on currency and percentage.

: What I have so far:

: procedure TForm1.Table1CalcFields(DataSet: TDataSet);
: begin
: Table1AgentGrossComm.Value := (Table1Coy_Gross_Commision.Value * Table2Split_Level.Value);
: End;

: Result is I get all $0.00 in the Calculated field.

: If I put in 0.65 in place of Table2Split_Level.Value (without the quotes of course) the calculation works perfectly.

: In Table1 the field is defined as : Table1Coy_Gross_Commision: TCurrencyField;

: In Table2 the field is defined as : Table2Split_Level: TFloatField;

Same as what webmaster Guido said - check that the record for table2 is valid. I usually use a TListBox on the form somewhere so i can add entries at troublesome/critical points in the code. For instance displaying Table1/Table2 record info when the cursor is moved (best use TDataSource.OnDataChange - only executing the code if Field = nil), or when the DataSet.State changes etc etc.


Related Articles and Replies:


[ DelphiLand Discussion Forum ]