Jump to: navigation, search

Assign Variables Block

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.

Tip
You specify user variables in the User Variables tab of the Initialize phase. When the application starts, those user variables are declared and assigned the user-specified default value.

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.

Important
The Assignments tab is processed before the Sort Function tab when your application executes the Assign Variables block. Do not assume that assignments are processed after sorting within the block. To extract specific parts of data after sorting, add another Assign Variables block after the one that performs sorting.

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.
  • Tip
    When assigning a string value to a variable, you must ensure that you enclose the string value with quotation marks. Otherwise, the string is interpreted as a reference to a variable.
Des assign assignments.png

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
Tip
You can specify a Key Data Type to use data-aware sorting to treat different keys differently. If you do not specify a data type, the sort function treats all sort keys as strings and sorts those strings.
Des assign sortfunction.png

Advanced Scripting tab

Important
Advanced Scripting is an optional feature and might not be enabled on your system. To enable this functionality, contact Genesys.

Click Advanced Scripting to enter your own ECMAScript expression.

Des assignvar advanced.png
This page was last edited on June 26, 2018, at 20:51.
Comments or questions about this documentation? Contact us for support!