Using Expressions

You can use two categories of data mapping expressions.

Basic Expression

Basic expressions can be written using any combination of the following by using operators:

Refer to Supported Operators for details on the operators that can be used within a basic expression.

Here are some examples of basic expressions:

string.concat("Rest Invoke response status code:",$activity[InvokeRESTService].statusCode)

The above example combines the string and the statusCode from the InvokeRestService activity.

string.length($activity[InvokeRESTService].responseBody.data) >=7

The above example checks whether the length of data of the responseBody is greater than or equal to 7.

$activity[InvokeRESTService].statusCode == 200 && $activity[InvokeRESTService].responseBody.data == "Success"

The above example checks whether the statusCode is 200 and the data of responseBody has the value as "Success".

Ternary Expression

Ternary expressions are assembled as follows:

condition ? statement1 : statement2

The condition is to be evaluated first. If it evaluates to true, then statement1 is executed. If the condition evaluates to false, then statement2 is executed.

Here is an example of basic ternary expression:

$Activity[InvokeRESTService].statusCode == 200 ? "Response successfully":"Response failed, status code not 200"

In the above example $Activity[InvokeRESTService].statusCode == 200 is the condition to be evaluated.

Here is an example of a nested ternary expression:

$Activity[InvokeRESTService].statusCode == 200 ? $Activity[InvokeRESTService].responseBody.data == "Success" ? "Response with correct data" : "Status ok but data unexpected" : "Response failed, status code not 200"

The example above checks first to see if statusCode equals 200.