Creating a Logical Expression

How to:

Reference:

A logical expression determines whether a particular condition is true. There are two kinds of logical expressions: relational and Boolean. The entities to be compared determine the kind of expression used:

You can use a logical expression to assign a value to a numeric field. If the expression is true, the field receives the value 1. If the expression is false, the field receives the value 0.

Reference: Logical Operators

The following is a list of common operators used in logical expressions. For information on relational operators and additional operators available for record selection using WHERE and IF, see Selecting Records for Your Report.

Operator

Description

EQ

Returns the value TRUE if the value on the left is equal to the value on the right.

NE

Returns the value TRUE if the value on the left is not equal to the value on the right.

GE

Returns the value TRUE if the value on the left is greater than or equal to the value on the right.

GT

Returns the value TRUE if the value on the left is greater than the value on the right.

LE

Returns the value TRUE if the value on the left is less than or equal to the value on the right.

LT

Returns the value TRUE if the value on the left is less than the value on the right.

AND

Returns the value TRUE if both operands are true.

OR

Returns the value TRUE if either operand is true.

NOT

Returns the value TRUE if the operand is false.

CONTAINS

Contains the specified character strings.

OMITS

Omits the specified character strings.

IS MISSING

Returns the value TRUE if the field is missing.

IS-NOT MISSING

Returns the value TRUE if the field is not missing.

Syntax: How to Write a Relational Expression

Any of the following are valid for a relational expression:

value {EQ|NE} value  value {LE|LT} value value {GE|GT} valuecharacter_value {CONTAINS|OMITS} character_value

where:

value
Is a field value or constant.
character_value
Is a character string. If it contains blanks, the string must be enclosed in single quotation marks.

Syntax: How to Write a Boolean Expression

Either of the following is valid for a Boolean expression:

(relational_expression) {AND|OR} (relational_expression)
NOT (logical_expression)

where:

relational_expression
Is an expression based on a comparison of two individual values (either field values or constants).
logical_expression
Is an expression that evaluates to the value TRUE or FALSE. If the expression is true, the field receives the value 1. If the expression is false, the field receives the value 0. The expression must be enclosed in parentheses.

Information Builders