Set Variable
The “Set Variable” panel adds new variables or updates existing ones within your Logic flow. Interaction variables are helpful because they can be used dynamically throughout logic flows to make decisions and track information.
Using this panel
Many panels accept variables in their configuration, allowing for dynamic output that changes based on what values are contained in those variables. Use the Set Variable panel to adjust variables as needed for your use case(s). This panel creates individual entries for each variable created or updated.
Configuration
Set as Flow Initiator: By selecting "Set as Flow Initiator," this panel will serve as the starting point of the IVR flow, before proceeding to subsequent panels within the Logic+ flow.
Panel Name: It is recommended that you choose a name and keep it consistent.
Panel Description: It is recommended to provide a clear description of the panel, detailing its purpose and functionality. This is akin to documentation, making it easier for others to understand and identify its intended use when they encounter it.
Variable Name: The variable name should be clear and concise to enhance understanding of its purpose. For example, I have set the ANI as
callerID
for an easy-to-understand reference later in the flow. When referencing a variable set outside this panel, one can use thecallerID
example as$(callerID)
or refer to it as$(yourVariableNameHere)
.Value Type:
Simple: The Simple value type updates the specified variable to a new string value.
Expression: You can also use an Expression value type to manipulate the values of existing fields.
Function(s)
Subtract: Takes two numbers and subtracts the second number from the first. Example:
10 - 3 = 7
.Add: Adds two numbers together. Example:
5 + 2 = 7
.Multiply: Multiplies two numbers. Example:
4 * 3 = 12
.Divide: Divides the first number by the second. Example:
12 / 4 = 3
.Append: Adds (appends) an element to the end of a list or array. Example:
[1, 2, 3] + 4 = [1, 2, 3, 4]
.JSON Path: Allows querying and extracting specific values from a JSON object using a path expression. Example:
$.store.book[0].title
would get the title of the first book in a store.Round: Rounds a number to the nearest whole number or to a specified number of decimal places. Example:
3.7
becomes4
, or3.14159
rounded to two decimals is3.14
.Absolute Value: Returns the positive value of a number, regardless of whether it's negative. Example:
|-5| = 5
.Slice: Extracts a portion (or slice) of a list or string. Example: slicing the first 3 characters from
"hello"
gives"hel"
.Random Number: Generates a random number within a specified range.
Length: Returns the number of elements in an array, or the number of characters in a string. Example: the length of
"hello"
is5
.Replace: Replaces occurrences of a substring within a string with another substring. Example: replacing
"dog"
with"cat"
in"doghouse"
gives"cathouse"
.Regex Replace: Uses regular expressions to find patterns in a string and replace them with something else. Example: replacing all digits in a string with
"X"
.
Exit Path: The Default path is taken upon panel execution.
There is a 1,000-character limit on the value of variables set in Logic+.
To return data to Classic Logic, dotCX, and action bots, you can use the Set Variable Panel and a variable naming convention of 'SharpenCX_ClassicLogic_<varName>'. The Classic Logic flow will have access to a call variable named <varName>.
Related Article: Available Predefined Variables