If

The IF action provides an expression evaluation to either True or False. It is used for an If then Else routing control. The IF action can use any number of logical variables as input on either side of the equation.

Every expression consists of at least two operands and can have one or more operators. Operands are values, whereas operators are symbols that represent particular actions. For example, in the expression X + Y - 10. X, Y, and 10 are operands, and + and - are operators.

The following lists the valid operators.

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
^ Exponentiation (for example: 2^3 = 8)
% Modulus (for example: 5%2 = 1)
( ) Force precedence of evaluation
>> Bitwise shift right
<< Bitwise shift left
& Not implemented as an operator, see the and function below.
| Not implemented as an operator, see the or function below.
^ Not implemented as an operator, see the xor function below.
~ Not implemented as an operator, see the not function below.

The following lists the valid logical operators for conditional operations:

Logical Operator Description
== Equal
!= Not Equal
< Less Than
<= Less Than or Equal
> Greater Than
>= Greater Than or Equal
&& And (for example: x==5&&y==10 returns true if x is 5 and y is 10)
|| Or (for example: x==5 || y==10 returns true if x is 5 or y is 10)
! Not (for example: !(x==5) returns false if x is 5)

There are also a number of built-in functions that can be used in an expression, such as sin(X) and log(X).

Parameter description

Input area Description
Formula Use the Formula box to type an expression.

As you type in the Formula box, the logical variables used in the expression are automatically added to the Input tab.
In the example expression, x==y (x is equal to y), the logical variables x and y are added to the input tab.
Functions Use the Functions list to add a built-in function to the formula.

To add a built-in function, double-click the function. The function is added to the Formula box.
Note that the default input operand to the abs( ) function is X. You can change this to any value you want.
When using the trig functions, the angle is specified in radians. For example, sin(1.0) = 0.841471. The 1.0 is equivalent to 1 radian:
where 2 pi radians equals 360 degrees

The following table lists the built-in functions that you can use within an If action.

Function Description
abs(X) Absolute value
acos(X) Trigonometric arcosine
and(X,Y) Bitwise AND "&"
asin(X) Trigonometric arcsine
atan(X) Trigonometric arctangent
avg(X1, X2...,Xn) Average of a set of values
ceil(X) Ceiling (round up)
cos(X) Trigonometric cosine
cosh(X) Hyperbolic cosine
exp(X) e to the power X
floor(X) Floor (round down)
ln(X) Natural log (base e)
log(X) Natural log (base e)
log10(X) Log base 10
max(X1, X2...,Xn) Maximum of a set of values
min(X1, X2...,Xn) Minimum of a set of values
not(X) Bitwise NOT "~"
or(X,Y) Bitwise OR "|"
sin(X) Trigonometric sine
sinh(X) Hyperbolic sine
sqrt(X) Square root
sum(X1, X2...,Xn) Sum of a set of values
tan(X) Trigonometric tangent
tanh(X) Hyperbolic tangent
xor(X,Y) Bitwise XOR "^"

Input tab

Parameter Description
Name Each row is a logical variable automatically created when you type the expression.
For this example,  the logical variables x and y where entered in the expression
  • All logical variables used in an expression have the data type FLOAT8 which is an 8 byte floating point number. You might see LREAL as the default data type which is also an 8 byte floating point number.
  • Select the Value column to select from a list of variables. For this example, two local variables were previously defined.

    Although shown, do not specify a trigger macro. Also, you can only specify a numeric constant.

For this example, the completed Input tab will be similar to the following:

Routing tab

Parameter Description
True The route to take when the expression evaluates to True.
False The route to take when the expression evaluates to False.
Failure The route to take if there is a failure.

Related Topics Link IconRelated Topics