Taskflows > Taskflows > The Expression Editor
  

The Expression Editor

Use fields, functions, and operators to create expressions in the Expression Editor.
If you assign the value Formula to a field, you must create a formula or an expression for the field to take data from. Use the Expression Editor to create expressions.
In the following image, fields str and str2 have the value Formula:
An Assignment step with two fields assigned the value Formula.
To open the Expression Editor, click f(x) next to a field with the value Formula.
The following image shows the Expression Editor dialog box:
The Expression Editor with the sections Fields, Functions, Operators, and Expression.
The Expression Editor contains the following sections:
The expression in the image defines a temporary field, Total Status, as Pass if three tasks that run in parallel succeed.
Next, the taskflow uses Total Status in a Data Decision step. If the value of Total Status is Pass, the taskflow runs another Data Task. If the value of Total Status is Fail, the taskflow ends.
The following image shows the taskflow that uses Total Status:
A taskflow with the Assignment step selected and the temporary field, Total Status, created with a formula.
Use the following options to create an expression:
The Expression Editor validates the expression as you enter it. You cannot save an expression that is not valid.

Tips: Using XQuery 3.0 to create expressions

Use XQuery version 3.0 to create expressions in the Expression Editor. The samples in this topic show you the syntax and the elements that you use to construct single statement and multi statement XQuery expressions.
For information about XQuery 3.0, see https://www.w3.org/TR/xquery-30/.

Single statement expression

The following expression is a single statement expression:
concat("Hello"," ",$input.n1)
The following notes explain the parts of this expression:
Assume that the value of $n1 is "World".
If you run:
concat("Hello", " ",$input.n1)
you get the following output:
Hello World

Multi-statement expression

The following expression is a multi-statement expression:

let $n1 := number($input.n1)
let $n2 := number($input.n2)

let $r1 := if ($n1 > $n2)
then "Greater: N1 > N2"
else if ($n1 < $n2)
then "Less: N1 < N2"
else "Same"
return $r1
The following notes explain the parts of this expression:
Assume that the value of $n1 is 20 and the value of $n2 is 250.
If you run:

let $n1 := number($input.n1)
let $n2 := number($input.n2)

let $r1 := if ($n1 > $n2)
then "Greater: N1 > N2"
else if ($n1 < $n2)
then "Less: N1 < N2"
else "Same"
return $r1
you get the following output:
Less: N1<N2
Here, $r1 now has the value
Less: N1<N2

Keyboard shortcuts

You can use keyboard shortcuts when you create an expression.
To use keyboard shortcuts, place the pointer inside the Expression section.
The following keyboard shortcuts are available:
Action
Shortcut
Undo
Ctrl+Z
Redo
Ctrl+Y
Copy
Ctrl+C
Cut
Ctrl+X
Paste
Ctrl+V
Find
Ctrl+F
Indent four spaces
Tab
Show list of available variables
$
Code Completion, that is, show a list of available insertions. The insertions might be name spaces, functions, fields, or common code fragments.
Ctrl+Space