XenoGuard 4.0 Documentation

If

ActionStep Reference » Programming » Flow Control » If 

The ActionStep If executes one or more ActionSteps depending on the result of a conditional expression. If the condition is met, i.e. the expression result is True, the Then branch is traversed and the ActionSteps contained therein are executed. In the other case, the Else branch is processed. The Then and Else branches may be empty.

 

[-] Hide
  1. Open the Programming node in the Workspace Explorer.
  2. In the Flow Control node, select the If ActionStep.

Parameters:

The ActionStep has the following input parameters:


name Description
Left Expression The initial ActionStep, parameter, or value to be compared.

Allowed Context Scopes
[Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Result, Enum]
Operator
The operation to be used when comparing the expressions.

Allowed Context Scopes
[Fixed]
Right Expression
Another ActionStep, parameter, or value to be compared.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Result, Enum]
[-] Hide

Here are the operators that can be used to compare the expressions:

  • State - can either be "Passed" or "Failed"
  • Contains  
  • Contains Not  
  • Contains RegEx  
  • Contains Not RegEx  
  • ==
  • !=
  • == RegEx
  • != RegEx
  • >
  • >=
  • <
  • <=
  • Item Count >
  • Item Count >=
  • Item Count <
  • Item Count <=

Branches:

The ActionStep has two branches:

name
description
Then
Contains ActionStep(s) when the condition is met.
Else
Contains ActionStep(s) when the condition is not met.

Results:

The ActionStep does not return a result.

Information

The ActionSteps to be executed are placed in the "Then" branch when the specified condition is met, otherwise ActionSteps should be placed in the "Else" branch. The Else branch may or may not contain an ActionStep when it is executed.

The If ActionStep can be nested within either the "Then" branch or "Else" branch.

Example 1 (Display the comparison result in a message box):

This example compares the value of two local variables, numValue 1 and numValue 2. Both use the data type Number. The result of the comparison of the two variables is then output via Message Box.


Example 2 (Check if the parameter value is taxable):

In this example, the content of the local parameter Income is checked, which has a floating point data type. The ActionStep in the Then branch is executed if the income is greater than or equal to the specified amount and is then output via Message Box. Otherwise, the ActionStep in the Else branch is executed and then output via Write Text.

Example 3 (Run a nested If statement for a variable):

The following example uses two nested If statements to compare the value of the variable Access Key. The first If uses a regular expression "[0-9]+" to check that the value of the variable contains only the numbers 0 through 9. The second If ensures that the length of the key contains six digits. If both conditions are true, a  Message Box appears indicating that the key is valid.

See other Flow Control ActionSteps:

For Loop
For Each
While
Break
Label
GoTo
Parallel
On Error Continue
On Error GoTo
Abort
Abort on Error