Expression Editor

The expression editor allows you to create and edit expressions in your automation.

In the interface of the Cloud Studio, expressions can be:
  • A constant

    • as a string

    • as a number

    • as a boolean

  • A variable: coming from the input of the current automation you are editing, or from the output of a specific step used in the automation

  • A complex expression (for example to express a condition). Unlike constants or variables, you can define a complex expression only by using the expression editor.

When building an automation in the Cloud Studio, you use expressions in:
  • Input and output parameters of steps

    For more information on input and output parameters, see Input/Output Parameters.

  • Conditions: to express the different cases, or in the outputs of a condition

  • Loops (for iterators)

  • Output parameters of the automation

Using the Expression Editor

  1. In your automation, select a step and click the button on the side panel. The following example shows the expression editor button that you can use to define the input parameter of an activity.

  2. The expression editor dialog opens. It's an editor of type JavaScript in which you can manually type your expression, or use the predefined references (variables, operators and functions).

  3. Click Test to check that your expression is valid.

    The test of your expression checks if:
    • the syntax is correct

    • the variables used in the expression exist

    • the functions and operators used in the expression are allowed in the expression editor grammar.

    • the type of the expression is compatible: an expression of type any can be of any type, but the other types of expressions must respect the expected type.

  4. Click Save.

References in the Expression Editor

Variables

A variable represents a data and is used to store information. Once you name a variable and define its value and type, you can use and reference it throughout your project.

When you edit the expression of a step, the expression editor shows you the variables and their type, that are available for this step.

In the example above, the variable returnedValues comes from the step 4 of the automation and is of type any.

Operators

An operator performs a specific operation on a set of expressions. You can use three types of operators:
  • arithmetic

  • logic

  • comparison

In the expression editor, when you click on the dropdown menu next to Operators, you can see a list of all the operators available, with a definition. You can clik on any operator to add it to your expression.

Functions

A function performs a specific operation on the expression (for example remove the space at the beginning and end of a string of characters). Four types of functions are available:
  • string

  • number

  • array

  • math

In the expression editor, when you click on the dropdown menu next to Functions, you can see a list of all the functions available, with a definition. You can click on any function to add it to your expression.