Condition functions

Condition functions are used in the Condition step property and in the condition attribute in adaptor XML elements.

The following functions are available:

true(expression)
Returns true if expression is true.
false(expression)
Returns true if the expression is false.
contains(a,b)
Returns true if string a contains string b. The a and b parameters can be literal strings or variables. Literal strings should not be quoted. If literal strings are quoted, the quotes become part of the string that is evaluated.
Note: Before Rational Build Forge version 7.1.2, this function returned true if string a was in string b.
hastext(var)
Returns true if the variable is not empty. Var is a variable set within Build Forge.
isempty(var)
Returns true if the variable is empty. Var is a variable set within Build Forge.
a eq b
Returns true if a is equal to b. The a and b parameters can be variables set within Build Forge or literal values. Character and numeric types can be used. Use a space between the parameters and the operator.
a ne b
Returns true if a is not equal to b. The a and b parameters can be variables set within Build Forge or literal values. Character and numeric types can be used. Character and numeric types can be used. Use a space between the parameters and the operator.
a contains b
Returns true if string b is found in string a. Literal strings should not be quoted. If literal strings are quoted, the quotes become part of the string that is evaluated. Character and numeric types can be used. Use a space between the parameters and the operator.

Expressions in functions

The expression parameter of the true() and false() functions can use the following operators:
a==b
Tests equality. Parameters can be strings or numbers. Parameters can be literals or variables defined in Build Forge.
a eq b
Tests equality. Parameters can be strings or numbers. Parameters can be literals or variables defined in Build Forge. Use a space between the parameters and the operator.
a!=b
Tests inequality. Parameters can be strings or numbers. Parameters can be literals or variables defined in Build Forge.
a ne b
Tests inequality. Parameters can be strings or numbers. Parameters can be literals or variables defined in Build Forge. Use a space between the parameters and the operator.
a>b
Tests that a is greater than b. Parameters must be numeric. Parameters can be literals or variables defined in Build Forge. Literals can use arithmetic operators, for example 2+2.
a<b
Tests that a is not greater than b. Parameters must be numeric. Parameters can be literals or variables defined in Build Forge. Literals can use arithmetic operators, for example 2+2.
a>=b
Tests that a is greater than or equal to b. Parameters must be numeric. Parameters can be literals or variables defined in Build Forge. Literals can use arithmetic operators, for example 2+2.
a<=b
Tests that a is not greater than or equal to b. Parameters must be numeric. Parameters can be literals or variables defined in Build Forge. Literals can use arithmetic operators, for example 2+2.
a contains b
Tests that string b is found in string a. Parameters can be literals or variables defined in Build Forge. Literal strings should not be quoted.

Examples of Condition functions

In the examples in the table below, variables are set as follows:
  • $AVAL contains the value String.
  • $BVAL contains the value 3.
Condition Evaluates To Notes
A String contains $AVAL TRUE String comparison
A String contains "String" FALSE The quotes around String become part of the comparison.
true(A String contains $AVAL) TRUE String comparison
$AVAL contains String TRUE String comparison
$AVAL contains "String" FALSE The quotes around String become part of the comparison.
contains(A String,$AVAL) TRUE String comparison
true(A String contains "$AVAL") FALSE The quotes around $AVAL become part of the comparison; "A String" does not have a quotes around the "String" part.
A String != $AVAL TRUE String comparison
A String ne $AVAL TRUE String comparison
false("Not Here" contains $AVAL) TRUE Test string comparison
true(2+1 == $BVAL) TRUE Numeric expression for equality
false(2+2 < $BVAL) TRUE Numeric expression for inequality
$AVAL eq $AVAL TRUE Test string comparison
true($AVAL ne Linus) TRUE Test string comparison
true($BVAL > 2+2) FALSE (3 > 2+2) is not true
contains(Not Here, $AVAL) FALSE Test string comparison

Feedback