Hi Everyone,
So I'm trying to modify the sales line table (37) to add a field I named "Total Net Weight"... All I would like it to do is take field 35 "Net Weight" and multiply it by the "Quantity" field 15 and display on my new field...
I first tried to set my new field to be a FlowField and use CalcFormula to summat the lines but I really don't think this is the proper way to do it. Can anyone provide any guidance?
Thank you
-rico1931
0
Answers
When do you want this calculation? After pressing any caption or entering any value.
You need to use onvalidate trigger or onpush action triggers..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
- Create a field in the Sales line table.
- On the OnValidate trigger of this field which you have created add the code to multiply the Quantity with Net weight and store in Total Net weight field like this
Total net weight field = Quantity * Net weight;
- On the sales line page, on the onValidate trigger of Quantity field do
SalesLine."Total Net Weight".OnValidate(TRUE);
this will call your table on validate trigger.
Thats it. Please verify my answer if it helps you.
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
At this time I was thinking that maybe if I ran the table I could see the total net weight calculated but did not.
After that I went to the Sales Line Order subform to do what you both said and use the onvalidate trigger in the "Quantity" field...
Only problem here is that for some reason SalesLine."Total Net Weight".OnValidate(TRUE); won't work because SalesLine is an unknown variable... but how so when it's the table that is attached to the sales order subform?
So I went into the C/AL Globals and defined SalesLine as a record with subtype Sales Line and now it's telling me the variable is not a record. "Variable.Field" is invalid. But I thought that's how you always called fields that are in a table?
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
Also press f5 and check in the symbol menu whether the onValidate trigger is available or not?
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
Looks like everything that is available is a function... and to my knowledge the functions are from codeunits that I'm not entirely ready to start messing with lol. But hey please let me know if I'm wrong.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav