Sum
  • 31 May 2023
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Sum

  • Dark
    Light
  • PDF

Article Summary

The Sum node calculates the total value of the specified parameters of the passing tasks and stores the accumulated results. Unlike other nodes, the total value is not added to the tasks but is stored within the node itself. This makes it ideal for gathering process statistics and monitoring specific parameters (see Picture 1).

Sum.png

Picture 1. Sum node task flow

The Sum node is useful for generating statistics and monitoring specific parameters in your processes. You can access the Sum totals in other nodes, processes, and dashboards, where you can analyze and track them over time.

Node Settings

Summation parameters

The Sum node provides parameters you want to summarize:

image.png

Picture 2. Example of Sum node parameters

Key - the sum or counter name. This parameter will store the total;

Value - the amount that will be added to the sum.

Summed parameters

The summed parameter must have the type 'number'. It can be a constant or a variable.

Add "key-value" - add a set of summation parameters;

Sum ID - can be accessed by clicking the information icon. Allows you to access the sum value from a process.

Other

Alert if the number of tasks in the node queue reaches the following number - a condition that will be met when the node has a specified number of tasks in it. If this option is selected, a new edge will be created.

Maximum interval, for which the task stays in the node before being forwarded - the amount of time a task must spend in this node. Can be specified in seconds, minutes, hours, or days.

Getting values from a Sum node

You can retrieve a value from a Sum node with:

{{node[node_ID].SumID}}

node_ID - ID of a node that contains the sum you want to get.
SumID - ID of the sum you want to get.

Examples

Using Sum as a counter

To use the Sum node as a counter, you can add a new parameter within the node and set its value to a number (positive or negative) for each count. As tasks pass through the node, the counter value will be increased by this specified number.

For example, you might add a new parameter called "Counter" and set its value to 1. Each time a task passes through the node, the counter value will increase by 1, effectively counting the number of tasks that have passed through the node (see Picture 3).

sum-counter.png

Picture 3. Using a counter parameter in a Sum node

Such a counter can be used, for example, to control the number of payments or charges against an account or to keep a record of different payment types/multiple accounts.

You can view the current Counter value in a Dashboard or access its value in a process or a State Diagram.

Summing up a parameter

To calculate the total value of a parameter, add a sum parameter to the node where you want to store the accumulated total. Begin by naming the new parameter, then specify the task parameter that you want to total.

For example, let's name our sum parameter "Payment_total" and assign the "amount" parameter value to it (see Picture 4).

sum-totalling.png

Picture 4. Example of using a parameter to accumulate numbers in a Sum node

The Sum node will track and accumulate the values of the "amount" task parameter as tasks pass through, calculating the total and storing it in the "Payment_total" parameter.

You can total up multiple task parameters within your sum parameter using the $.math({{param1}}+{{param2}}) math function.

Showing Sum parameter values in a Dashboard

To view the sum values in a Dashboard, you simply need to select them in the Dashboard metrics. After you've selected your process, it will show you all the Sum nodes it includes, along with their summation parameters. Simply add the ones you want to track (see Picture 5):

sum-added metrics.png

Picture 5. Adding metrics to the selected process with a Sum node to display them in a Dashboard

You can see that we ran two tasks through our node because the "Counter" equals 2 with the “Payment_total” of 150 (see Picture 6):

sum-metrics view.png

Picture 6. Viewing the chart statistics maintained in Sum nodes

Error handling & troubleshooting

When an error occurs in the node, the following fields are added to the initial task depending on the error and node type:

Error parameter nameParameter description
__conveyor_node_type_return_type_error__Error type: hardware (system error), software (error in a node logic/settings)
__conveyor_node_type_return_type_tag__Error tag
__conveyor_node_type_return_type_description__Error description in human-readable language. Can be static or dynamic
ProblemCauseSolution
The summed parameter is not a numberParameter in the node is not of type numberChange its type to number