Expression
- Last Updated: February 11, 2026
- 5 minute read
- OpenEdge
- Version 13.0
- Documentation
A combination of one or more terms and operators that evaluate to a single value of a specific data type.
Syntax
|
- unary-operator
- Any ABL unary operator that can precede the specified term, including the:
- (
- Begins a group of one or more terms and operators that are evaluated together before any terms or operators to the left of the ‘('. If specified, the group must be terminated with a ‘)'.
- term
- Any one of the following ABL elements that represents or returns
a value with a data type that is compatible with the expression
data type, including:
- A literal (constant) value represented according to its data type (Data types)
- A database or temp-table field reference (Record phrase, DEFINE TEMP-TABLE statement)
- A reference to a variable scoped to the current procedure, user-defined function, or method of a class, or to an accessible class-based variable data member, including a subscripted or unsubscripted array reference (VAR statement, DEFINE VARIABLE statement, Class-based data member access)
- A reference to a parameter (of any mode) defined for the current procedure, user-defined function, or method of a class, including a subscripted or unsubscripted array reference (DEFINE PARAMETER statement)
- A reference to a readable class-based property or COM property, including a subscripted or unsubscripted array reference (DEFINE PROPERTY statement, Class-based property access, Accessing COM object properties and methods)
- Readable handle attribute reference (Accessing handle attributes and methods)
- Readable system handle reference (Handle Reference)
- An ABL built-in or user-defined function call (FUNCTION statement)
- A handle method, non-VOID COM method, or non-VOID class-based method call (Accessing handle attributes and methods, Accessing COM object properties and methods, Class-based method call)
- An #rfi1424920512384 (recursive)
Note that each term of the expression can itself be formed from an expression, resulting in multiple possible combinations of basic terms and operators, with or without grouping parentheses. Note that each of these elements, except for a more complex Expression, represents a basic term of the expression.
- binary-operator
- Any ABL binary operator that can separate two term elements,
each of which must have a data type that is compatible with an expression
that can result when applying the specified binary-operator to
the specified term elements, including the:
- + Addition operator
- + Concatenation operator
- + Date addition operator
- + Datetime addition operator
- - Subtraction operator
- - Date subtraction operator
- - Datetime subtraction operator
- * Multiplication operator
- / Division operator
- AND operator (bitwise)
- AND operator (logical)
- BEGINS operator
- EQ or = operator
- GE or >= operator
- GT or > operator
- LE or < = operator
- LT or < operator
- MATCHES operator
- MODULO operator
- NE or <> operator
- OR operator (logical)
- OR operator (bitwise)
- XOR operator (bitwise)
- )
- Terminates a group of one or more terms and operators that are evaluated together before any terms or operators to the right of the ‘)'. If specified, the group must begin with a ‘('.
For information on the precedence of operator evaluation, see Table 1.
Example
The
procedure, r-expression.p, evaluates an expression to
identify the value of an element in an ABL single-dimensional array (iArray)
that is specified using two-dimensional coordinates (iDim1 and iDim2):
r-expression.p
|
This procedure contains several expressions
in the DO statements as well as in the MESSAGE statement. The expression
that evaluates the index on the term, iArray, using
a two-dimensional coordinate is shown in bold. This expression first
evaluates the subtraction (-) operation in parentheses,
then, in order by operator precedence, evaluates the multiplication
(*) operation followed by the addition operation
(+).
Notes
- A
series of terms and operators in an expression, with no grouping
parentheses (‘(' and ‘)'), evaluate in an order of precedence determined
by the operators. Thus, operators of higher precedence evaluate
before operators of lower precedence, and operators of the same precedence
evaluate in order from left to right. Otherwise, a series of terms and
operators within a particular grouping parentheses evaluate according
to their precedence before any series of terms and operators outside
that grouping parentheses. The following table shows the order of precedence
for ABL operators identified by function and symbol.
Table 1. ABL operator precedence Precedence (highest to lowest) Operator function Symbol 11 Numeric negative (unary) Numeric positive (unary)
- +
10 Numeric modulo Numeric division
Numeric multiplication
MODULO /
*
9 Date subtraction Datetime subtraction
Numeric subtraction
Date addition
Datetime addition
Numeric addition
String concatenation
- -
-
+
+
+
+
8 Relational string match Relational less than
Relational less than or equal to
Relational greater than
Relational greater than or equal to
Relational equal to
Relational not equal to
Relational string beginning
MATCHES LT or <
LE or <=
GT or >
GE or >=
EQ or =
NE or <>
BEGINS
7 Bitwise NOT (unary) NOT 6 Logical NOT (unary) NOT 5 Bitwise AND AND 4 Bitwise XOR XOR 3 Bitwise OR (inclusive) OR 2 Logical AND AND 1 Logical OR (inclusive) OR Note that before the ABL Virtual Machine (AVM) applies the operators to an expression, it evaluates all the basic terms (variables, properties, methods, functions, etc.) of the expression individually from left to right.
- If you do not include any white space in expressions, ABL does not distinguish between a hyphen (-) used as an operator and a hyphen used as part of an ABL built-in or user-defined element name. In order to enable ABL to identify a hyphen used as an operator, you must add at least one space between the hyphen and the term or terms that the operator evaluates.
- An expression of the appropriate data type can appear as a variable option of any ABL statement that takes an expression, except where specified. Expressions commonly appear in the Assignment (=) statement, ASSIGN statement, and as arguments to INPUT parameters of procedures, functions, and methods (Parameter passing syntax). Expressions cannot appear where a variable syntax option accepts only a quoted string, a user-defined name (such as a procedure or variable name), or a compile-time constant. Other restrictions might also apply.
- You cannot directly reference a BLOB or CLOB database or temp-table field as a term in an expression, except as specifically provided in a given ABL statement or built-in function. Generally, you must first convert the BLOB or CLOB to a MEMPTR or LONGCHAR data type using the COPY-LOB statement, then use the result in the expression.
- When a run-time error occurs in any part of an expression, the AVM stops evaluating the expression and raises the ERROR condition on the statement that contains the expression. If the error occurs in a basic term of the expression, because the AVM first evaluates all the basic terms of an expression from left to right, all such terms (especially, methods and functions) prior to the term that raises ERROR will complete execution. However, any data element set to receive the result of the expression evaluation remains unchanged, for example, when the expression is on the right-hand side of an Assignment (=) statement or is passed to an INPUT parameter. The ERROR condition from an expression can be handled, like any statement error, as appropriate for the specified statement and block error processing, including use of statement NO-ERROR options, ON ERROR phrases, and CATCH statements to handle any error messages and error objects returned from the expression. For more information, see ABL Error Handling.
See also
Assignment (=) statement, ASSIGN statement, CATCH statement, COPY-LOB statement, Data types, ERROR-STATUS system handle, Parameter passing syntax