I am extending the Item Master table and page with 7 Integer type fields.
Let's call them;
Field1
Field2
Field3
Field4
Field1Calculated (Editable = False)
Field2Calculated (Editable = False)
Field3Calculated (Editable = False)
Field1Calculated will be the Value of Field1;
Field2Calculated will be the Value ("Field1" + "Field2") - "Field3"
Field3Calculated will be the Value (("Field1" + "Field2") - "Field3") - "Field4";
I tried writing the code on the OnValidate() in such a way
trigger OnValidate()
var
begin
"Field2Calculated" := ("Field1" + "Field2") - "Field3"
end;
However this seems to not work since I would want for any of the FieldX Value users changes, I would want to fire the calculation logics of all 3 FieldXCaclulated fields to update in the table respective changes.
How do I go about implementing this?
Thanks a ton in advance for the guidance.
0
Answers
If you don't need the calculated fields in the table, just do your calculations on the Page and use global variables. Do your calculation in the OnAfterGetRecord and in the OnValidate trigger of Field1..4.