Understanding Variable Usage in Expressions
Definition
Single Output Expression
|
Usage |
Example |
|---|---|
|
Assign an expression to a variable that you want to get executed once and whose value can be used multiple times |
|
|
Use the variable for target node |
MultiOutput Expression:
|
Usage |
Example |
|---|---|
|
Create a multi-output function or use an existing one. |
|
|
Use the output of the function for multiple target node |
|
|
Use the first pin of the multi-output function to a target node |
Result("0",var("variable1")) OR var("variable1"). |
|
Use the second pin of the multi-output function to a target node |
result("1",var("variable1")) |
Some special cases of how text expressions with variables are represented in graphical editor:
Single Output Expression
The expression for variable is included as part of the expression of the target node in case the variable definition is after the target node where it is used first
Multi-output Expression
In case a target node is using any other output pin than the first pin, the output of the expression is directly assigned to the target node.
Special cases of how the graphical expressions are represented in the text expressions:
Expression without variable
Since the expression output is used multiple times, a new variable will be generated and it will look as follows:
The new variable gets added under the node which ever comes first among the target node using their input as the output of the expression .
In Text based editor the variable:
AirlineID_var1 = concat(/ns0:BookingOrderConfirmation/AgencyID,/ns0:BookingOrderConfirmation/OrderNumber,"")
AirlineID = var("AirlineID_var1")
BookingNumber=var("AirlineID_var1")
Expression with Variable
The output of the expression is used multiple times and a variable is one of the node where the output is going
In text-based editor the expression will look like:
variable1=concat(/ns0:BookingOrderConfirmation/AgencyID,/ns0:BookingOrderConfirmation/OrderNumber,"")
AirlineID = var("variable1")
BookingNumber = var("variable1")
This applies to the scenario where the output of the expression is used multiple times and a variable is NOT one of the node where the output is going