Typical issue is to show a calculated value in a factbox on base of the currently selected line in a list page or the lines in a subpage. Is it possible to get a calculated value on base of more than one selected line? Let’s check out.
Let’s say we want to display the sum of field “Credit Limit” in the customer list when selecting multiple lines. So first we edit page 9082 “Customer Statistics FactBox”. There we add a global variable SumCredLimit (decimal) to the page, then we add a new line in page with sourceexpr = SumCredLimit.

Now we add a new global function SetSumCredLimit.

Save and close the page. Now we edit page 21 customer list. There we rename page part “Customer Statistics FactBox” to CustStatFbx. That’s needed, so that we can reach the custom functions in page “Customer Statistics FactBox” from page “customer list”.

After that edit the page code (F9). Goto trigger OnAfterGetCurrRecord, there add local variable Cust (record|Customer). Add following code to trigger:

Save and close the page. Now run the Nav windows client and goto customer list.
The result:

You see, the new value in the factbox shows the sum of the Credit Limit values of the 3 selected lines.
cheers
Filed under: c/al, dynamics nav, nav 2013, nav 2015, nav 2016, nav functions Tagged: factbox, multiple line selection, sum

Like
Report
*This post is locked for comments