Calculate fields in one go.
mysamza
Member Posts: 66
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.
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 really need these fields as fields in the table, I would create a function that calculates the values of all three calculated fields and add this function to each of the editable fields' OnValidate trigger.
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.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
