Assign Variables Block
Contents
You can use the Assign Variables block in any phase of the application to assign a new value or expression to any of the user variables. Those variables can be used in other blocks whose properties support variables (for example, TTS prompts). The last-known state of variables is captured in metrics just before the SCXML session ends.
You can use the Sort Function tab to sort the elements of a JSON array in a specified order. A maximum of three keys can be specified with each array. The same array can be sorted multiple times; therefore, the number of sort keys is unlimited.
Assignments tab
Click Add Assignment to assign a value or expression to a variable.
- Select a variable from the Variable drop-down menu.
- Enter a value or expression for the variable in the Expression field. The value can be a simple literal value (such as a string, integer, or Boolean) or any valid JavaScript expression. The value expression can refer to other variables.
Sort Function tab
Click Add Sort Function and select an Input Array that contains a valid JSON array with values that you want to sort.
Enter up to three values in the Key to Sort By fields. These values must exist in the array. If an element does not have the specified value, it is skipped by the sort function and the value appears towards the end of the list.
Optionally, specify a Sort Order and Key Data Type. For the date type, you can use the following formats:
- yyyy-MM-ddTHH:mm:ssZ
- Example in Greenwich Mean Time (Zulu): 2015-06-01T12:13:14Z
- yyyy-MM-ddTHH:mm:ss[+-]HHmm
- Example in Pacific Time: 2015-06-01T12:13:14-0800
Advanced Scripting tab
Click Advanced Scripting to enter your own ECMAScript expression.