I have a page and table with various data, i want to sum up the data in each fields in the line and show in the page total i created without using the flowfield but a CODE unit. Can anyone assist or give me a walk through.
if your field to be summed up is of decimal type, and if you can use filters to isolate/select a set of records to be summarised, use CALCSUM
SomeRec.SETRANGE("Field 1", 'smth');
SomeRec.SETRANGE("Field 2", 'smth');
SomeRec.SETRANGE("Field 3", 'smth3', 'smth4');
SomeRec.CALCSUM("A decimal field to be summarised");
If your field is of the integer type, or the subset of records cannot be expressed in terms of NAV filters then you need to loop through records and add them up manually.
SomeRec.SETRANGE("Field 1", 'smth');
SomeRec.SETRANGE("Field 2", 'smth');
SomeRec.SETRANGE("Field 3", 'smth3', 'smth4');
IF SomeRec.FINDSET THEN
REPEAT
IF someComplicatedContition = TRUE THEN
Total += "A field to be summarised";
UNTIL SomeRec.NEXT = 0;
Then you need to assign calculated value to a global variable, and put a field on a Page with SourceExpr property set to this global variable
Answers
If your field is of the integer type, or the subset of records cannot be expressed in terms of NAV filters then you need to loop through records and add them up manually.
Then you need to assign calculated value to a global variable, and put a field on a Page with SourceExpr property set to this global variable
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!