Hi I am very new to AX 2012 development, can you help me calculate 2 fields in the form. For example CurrentKM and ActualKM. I need to display the difference of these two fields in a third field using calculation
KMDiff = ActualKM - CurrentKM.
How can I achieve this on the form level? Appreciate if someone can support me in this.
1
votes
Please check the following link msdn.microsoft.com/en-us/library/…
- Aliaksandr Maksimau
2 Answers
0
votes
Make controls auto declared, so You can reference them by name. Control property autodeclaration Expand + at data entry control. On methods node right click, Override method, modified. There fetch currently entered data by realValue method. Control3.realValue(Control1.realValue()-Control2.realValue()); This is strictly by form controls, if these are fields in table, then its different.
0
votes
You can create Display method to do this. here an example.
Step 1:: Declare a real variable for example real ShowAmount.
public class FormRun extends ObjectRun
{
real ShowAmount;
}
Step 2: Create a Display method like this
display real CalcAmount()
{
ShowAmount = 180 - 10; //Replace this static values for your calc.
return ShowAmount;
}
Step 3: Add in desing RealEdit. In DataMethod property set your Dysplay method name.
Step 4: Execute form and you can see the value.

