IBM FileNet P8, Version 5.2.1            

Operators

Operators indicate what operations, such as addition and subtraction, are to be performed on other parts of an expression.

Some operators have different meanings based on the data types being operated upon. For example, the plus sign (+) can indicate either addition between integers or concatenation between strings. In a complex expression, the operators are evaluated in order of precedence.

The following table lists the meaning of each operator. The operators are listed in order of precedence.

Table 1. Table of operators and their description
Operators (in order of precedence) Meaning Usage
Parentheses ( ) Logically groups expressions. (<expr>)
Arithmetic operators + - Unary plus and minus. Unary minus changes the sign of a number; unary plus does not. +<expr>-<expr>
  * / Multiplication and division. When dividing two integers, an integer is returned (if a float value results, the value is truncated to produce an integer). <expr>*<expr><expr>/<expr>
  + - Addition and subtraction of numeric values. The minus also subtracts the number of seconds between two times. <expr>+<expr><expr>-<expr>
String concatenation operator + Concatenates strings. <expr>+<expr>
Relative operators (all the same level of precedence)
  • <
  • >
  • =
  • <=
  • >=
  • <>
  • Less than.
  • Greater than.
  • Equal.
  • Less than or equal to.
  • Greater than or equal to.
  • Not equal to.
  • <expr> < <expr>
  • <expr> > <expr>
  • <expr> = <expr>
  • <expr> <= <expr>
  • <expr> >= <expr>
  • <expr> <> <expr>
Logical operators not Evaluates to true when the Boolean expression is false; evaluates to false when the Boolean expression is true. not <expr>
  and Evaluates to true when both expressions are true. <expr> and <expr>
  or Evaluates to true when either expression is true. <expr> or <expr>
  like Evaluates to true when the expression matches a pattern. The pattern contains the character string to search for, which can include wildcards. like <expr>
  is null is not null Tests for null values. A null value represents a lack of data. is null is not null

Operator usage

In an expression, the operands and result usually must be of the same data type and the operators must be valid for that data type. Note that mixing of numeric data types (that is, floats and integers) within an expression is allowed—for example, the expressions shown below are valid (FloatVal is a variable of type float):
3 * 2.5

FloatVal > 2

In mixed-type expressions, the integers are implicitly converted to floats before the operations are performed.

Operator precedence

Within an expression, operators with the same precedence are evaluated from left to right. In the integer expression shown below, for example, because division and multiplication have the same precedence, 6 is divided by 4, then the result is truncated (because the divisor and the dividend are integers) and multiplied by 2.
6/4*2 = 2
In an expression with many mixed-precedence operators, liberal use of parentheses makes the expression easier to understand and maintain. For example, below are two versions of the same expression; the parentheses used in the second version, however, make the expression logic more clear.
Num + 2 > 80 or Num - 2 < -20

((Num + 2) > 80) or ((Num - 2) < -20)


Last updated: March 2016
bpfe018.htm

© Copyright IBM Corporation 2016.