The Calculator action allows mathematical calculations to be included in a workflow. This article discusses the Calculator action in more detail.
Table of Contents
- Understanding the Calculator Action
- Sample Calculations
- Setting Up a Calculator Action
- Run for Table mode in the Calculator Action
- How a Calculator Action Appears in the User Application
Understanding the Calculator Action
The Calculator action allows mathematical calculations to be performed within a workflow. Inputs for these calculations are often stored in square brackets defined earlier in the workflow, allowing them for later use within the workflow. Results are stored in square brackets for further use as the workflow progresses.
Sample Calculations
The Calculator action allows the following calculations to be performed:
- addition [ + ]
- subtraction [ - ]
- division [ / ]
- multiplication [ * ]
Just like mathematics in the real world, you can simplify more complex calculations using parentheses and common operators such as Average and Sum.
Aside from the symbols and functions corresponding to the basic mathematical operations mentioned earlier, the following can be used in Calculator actions:
- Numbers 0-9
- Decimal points
- Numeric [square_brackets] created or calculated earlier in the workflow.
- When run for table mode is enabled you can also use the functions (), /, *, +, - on columns [table.column]
- SUM calculates the sum of all elements in a list. The syntax for SUM can be any of the following:
- SUM(number1, [number], ...)
- SUM(number1, number2, ...)
- SUM([number_list])
Note: The list of numbers in a table column [table.number_column.col] is a [number_list].
- AVERAGE returns the average (arithmetic mean) of the arguments. The syntax for AVERAGE can be any of the following:
- AVERAGE(number1, [number], ...)
- AVERAGE(number1, number2, ...)
- AVERAGE([number_list])
Note: The list of numbers in a table column [table.number_column.col] is a [number_list]. For example, the formula: AVERAGE(10, 20) returns the average of these numbers, which is 15.
- ROUND rounds a number to a specified number of digits
- As an example, ROUND([Number], -4), where [Number] is any real number to be rounded by 4 places to the left of the decimal point.
- If [Number] = 17000, it will be rounded to the nearest multiple of 10,000, which is 20,000.
- As an example, ROUND([Number], -4), where [Number] is any real number to be rounded by 4 places to the left of the decimal point.
- ROUNDUP rounds up a number, away from 0
- As an example, ROUNDUP([Number], 3)
- If [Number] = 3.14159, it is rounded up by three decimal places, with the result being 3.142.
- As an example, ROUNDUP([Number], 3)
- ROUNDDOWN rounds down a number towards 0.
- As an example, ROUNDDOWN([Number], 3)
- If [Number] = 3.14159, it is rounded down by three decimal places, with the result being 3.141.
- As an example, ROUNDDOWN([Number], 3)
- Variables with #NO_DATA values are always equal to 0. For example:
- 3 + NO_DATA = 3
- 3 - NO_DATA = 3
- SUM of NO_DATA values = 0;
- Any value * NO_DATA = 0
- Any value / by NO_DATA = NaN (Any value divided by 0 will result in an undefined value)
Setting Up a Calculator Action
Use a Calculator action anytime you need to perform calculations within a workflow.
To set up a Calculator action:
- Drag a Calculator action to the canvas of the Workflow Editor.
- Position your cursor over the action, then click the Edit icon when it appears.
- On the Action Editor, enter the formula to be used in the calculation. For example, [volume_barrels] * [price_per_barrel].
- Enter a name for the result, which will also be used as a square bracket. For example, in the above screenshot, Trade_value_USD is the name of the result from the formula entered in Step 3.
- Click Advanced Options and enter the decimal places that will be used when displaying the result.
- Click the x button on the top-left to save your changes and close the Action Editor.
Run for Table mode in the Calculator Action
The Calculator Action is one of several Actions in AUTTO that have a Run for Table option, which allows you to use it against every record in an existing table and enter the results into a new table. Using square brackets, you can then use the new table later on in the workflow. For more information, see Getting Started with Run for Table.
When run for table mode is enabled, you can also use the functions (), /, *, +, - on data table columns [table.column]. For example, with the Price table as the input, the USD_amount column is created in the output table by using the formula [Price.EUR_amount] / [Price.EUR_per_USD]
How a Calculator Action Appears in the User Application
The Calendar action does not appear in a Workflow. Workflow users may be asked to enter the inputs for the calculations but the workflow itself does not show these calculations being performed. This is why a Calculator action cannot be previewed.
Rather, the Calendar action does its work behind the scenes, performing calculations without showing on the User Application. The results are stored in the designated square bracket, which can be used later on as the workflow progresses.
Comments
0 comments
Article is closed for comments.