Skip to content


Tech Tuesday – Sum Document Line Amounts Using Global Variables

Today’s Tech Tuesday article comes to you from our Professional Service Director, Lorren Zemke:

Depending on the data source, there may be a time where you need to sum amounts from the line items into a document header. You may have a document that contains distribution details that need to be rounded or multiple data elements that need to be added together to store at the document header level. For this article we will be talking about summing amounts from an Excel file that has distribution amounts we need to sum together to create the voucher amount.

First, we will create a Global Variable that can be used to sum the values at a document line level and stored at a document header level. We start by creating a global variable which we will call GBL_PAYABLESTRXAMOUNT and assign a default value of 0. You can view a previous blog entry on how to create Global Variables and assign default values.

We will start with our Distribution node to create our calculated amounts that need to be summed. Our document source contains debit and credit amounts that may be negative or positive so we will create a calculated column for each.  Below is our DEBITCALC amount and we will do the opposite for the CREDITCALC.


We map the calculated Credit and Debit amounts to the distribution Credit Amount and Debit Amount destination columns respectively.


In the Restrictions script we sum the Debit and Credit calculated amounts to our Global Variable since the Restrictions script runs for each line in our data source while creating the Payables Distribution.


We are returning true in all cases for our Restriction because we are not restricting any lines just using the process for summing our values.

Now, we move to the Payables Header node where we take the summed amount and map it to the Payables amount.  To get the global variable amount create a new calculated column to return the global variable since we cannot use the global variable as a source column.


Normally in our calculated column we would clear the global variable for this document so the system would not continue to add amounts for multiple documents together. But Payables also has another destination column where we want to use the same amount as our purchases amount we will create another calculated column and clear our global variable in that calculation.


Once the document amount calculations have been created, map them to the destination columns.

Have further questions or comments on what Lorren shared? Drop him a line at

Leave a Comment


Join Us in Chicago at the Zendesk Showcase!
Tech Tuesday: Popdock - Joining the tale of two States
Meet eOne Solutions at Directions EMEA 2023!
Connect with eOne Solutions at SuiteWorld 2023!
What is a Data Lake/Data Lake Management?


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder



Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships Partner All Hands Call Popdock promotions release Salesforce SmartConnect SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training Zendesk

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.