Hi experts!! NAV2017
I need to add a field on the page with the accumulated balance, like the example
I wrote this code in the OnAfterGetRecord () trigger
IF NOT blnPrimero THEN BEGIN
decAcumulado:=0;
blnPrimero:=TRUE;
END;
decAcumulado+=Amount;
but it does not work
please any suggestions!!
Answers
Just my personal suggestion.
Add accumulated field in Page is not a good practice. Do this in report.
If you really want to do, add accumulated field in table, create a new page and calculate it by action.
why is not a good practice??
and
why a new page?
Well, performace is one concern, and the control of filtering, sorting is another concern.
Again, just my personal opinion.
The trouble with Pages is the control of calculation. How do you reset the blnPrimero when user clicks one of headers and change soting order? Or add a filter to get a subset of records?
I would agreed with @allenyyzhou - do it on a report. This is the a place where you can get it working much easier.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Even order in which the records are fetched is not guaranteed. Try scrolling a few lines an then try PageUp or PageDown.
If you want do do this on the page you would need to build much more complicated logic to control when to add up the amount and when to reset it back to 0.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03