Expressions tips and best practices


When you use the Expression Editor to create expressions for audio sequences or tasks, consider the following tips and best practices:

Check NOT_SET in expressions

Ensure that you check NOT_SET appropriately in expressions on parameters passed to function calls and operators such as +, -, /, >, >=, and so on.

Append strings

When you append strings, while it’s possible to write an expression like this:

"Hello " + Flow.CustomerFirstName+", welcome to your personal menu where you can review information about your account"

We recommend using the Append function instead so the above expression would be:

Append("Hello ", Flow.CustomerFirstName, ", welcome to your personal menu where you can review information about your account")

Append accepts NOT_SET parameter values, while the + operator does not. Append also contains slightly less overhead to execute at runtime, because all items you want to append are submitted to one function call; however, in the first example, each call to + results in another addition call plus storage for intermediate results. Simply put, the evaluation of “Hello “+Flow.CustomerFirstName happens first, the result is stored in a temporary location, and then the evaluation of the next addition operator is performed.

Find details about error messages

When an expression contains an error, Architect returns a message below the editor. To view details about the error, click the message and notice the following features:

  1. If the error contains a function name (for example, MakeDuration), then the function name appears in blue. Click it to open the Expression Help dialog box on the specified function's focus.
  2. The remainder of the error message appears in red. Click it to focus on the expression editor and scroll the input caret to the error location.

Preserve expressions when troubleshooting from Custom Expression to Sequence Builder

When creating audio sequences, switching from the Sequence Builder to the Custom Expression Builder will generate an audio expression. But if you create or review an expression in the Custom Expression Builder and switch back to the Sequence Builder, the Sequence Builder re-configures the sequence—it does not interpret the custom expression text. In this case, switching to the sequence builder will discard any changes made in the custom expression.

However, if a sequence built in Sequence Builder contains an error, viewing it in expression mode may be helpful in troubleshooting internal sequence dialog errors. Click an error link  to open and edit the expression in the Edit Expression dialog. This process will not reconfigure the sequence.