Compute

The Compute action allows you to perform mathematical operations within your flow.

The Compute action on a blank board

You might use the Compute action to:

  • Confirm a caller is over 18 after they provide their date of birth (using the Subtract operation).

  • Calculate the cost of one or multiple items plus sales tax in a shopping cart IVR (using the Add operation).

 

Supported mathematical operations include:

  • Add

  • Subtract

  • Multiply

  • Divide

 

Note: All operation results are returned to the hundredth decimal place (e.g., the operation "10+5" will return "15.00") and rounded to the hundredth decimal place (e.g., the operation “10.36 + 1.339” will return “11.70”).

 

Available Variables

Available Variables are placeholders for information that are automatically determined based on the contents of your flow. For example, if your flow begins with an Inbound Call trigger, the caller’s phone number is stored as a $ANI variable. You can include sending a follow up SMS to the caller later in your flow by including the $ANI variable in the Send SMS action Inputs.

You can drag and drop the variables displayed in this section into the Inputs and Advanced fields.

Check out How to Use Variables in SmartFlows for more information.

 

Inputs

Configure the following inputs to set up this action:

Input Name

Description

Operation*

Select the mathematical operation you want to perform from the drop-down list. *This is a required field.

Input 1*

The first number or variable in the mathematical operation. *This is a required field.

Input 2*

The second number or variable in the mathematical operation. *This is a required field.

Set Variable

Configure a custom variable for the result of your mathematical operation. If you don’t set a custom variable the default is ${Action_ID}.Result (e.g., $Compute_7.Result).

 

Action

Each Compute action includes two exit ports corresponding to the following outcomes:

  • On Success: The course of the flow if the mathematical operation is successfully performed (port 1)

  • On Error: The course of the flow if the mathematical operation is not successfully performed (port 2)

An action must be connected to each of the exit ports to deploy your flow and the port order cannot be rearranged.