Skip to main content

SUM

Use the SUM function to calculate the total of all numbers in the specified array.

Use​

SUM( array )
Sum together value of all array items.

ParameterRequiredDescription
arrayYesarray containing numbers to sum

ReturnsNumber

Examples​

Totaling Expense Claim Items (Variable Update)​

You can use SUM to aggregate multiple numeric entries captured in a single form field that allows for multiple values (a Number Array).

  • Scenario: A user submits an "Expense Report" trigger form where they list several individual costs (e.g., $50, $20, and $100) in a capture widget named "LineItemCosts".
  • Formula: SUM(@Trigger.out.LineItemCosts)
  • Placement: This formula would typically be used in a Variable Update (e.g., updating a variable called $TotalClaimAmount) after the trigger completes.
  • Logic: The function scans the array and returns the numeric value 170.

Consolidating Costs from Different Steps (Path Condition)​

If your numbers are stored in separate individual fields rather than a single array, you can combine them using the CREATE function before applying the SUM function.

  • Scenario: A "Construction Project" workflow has two separate activities: one for "Materials Cost" and another for "Labor Cost." You need to know if the combined total exceeds a threshold to decide the next path in a Conditional Branch.
  • Formula: SUM(CREATE(@MaterialsActivity.out.Cost, @LaborActivity.out.Cost)) > #BudgetCap
  • Logic:
    • CREATE(...): This function takes the individual outputs and bundles them into a temporary array.
    • SUM(...): This function then adds those bundled values together.
    • Result: If the sum is greater than the Constant #BudgetCap, the formula returns TRUE, and the approval follows the specified path.