Logical Operators
- Last UpdatedMar 28, 2023
- 3 minute read
The logical operators available are:
|
Operator |
Comments |
|---|---|
|
AND |
|
|
EQ, NE |
The operators EQ and NE may be applied to any pair of values of the same type. |
|
GT, GE, LE, LT |
The operators GE, LE, GT, and LT may only be used with numbers and positions. Refer to Positions, Directions and Orientations in Expressions (AVEVA E3D Design only) for further information. |
|
NOT |
|
|
OR |
Note:
The operators EQ, NE, LT, GT, LE, and GE are sometimes referred to as comparator or relational operators; NOT, AND, and OR are sometimes referred to as Boolean operators. Refer to Precision of Comparisons for tolerances in comparing numbers.
AND
|
Synopsis |
log1 AND log2 |
-> logical |
|
Description |
Perform the logical AND between two logical values. Treats unset values as FALSE. |
|
|
Side Effects |
If one of the values is undefined and the other one is FALSE, the result is FALSE. |
|
|
Example |
TRUE and FALSE -> FALSE |
|
EQ and NE
|
Synopsis |
( number1 EQual number2) |
-> logical |
|
( text1 EQual text2 ) |
-> logical |
|
|
( log1 EQual log2 ) |
-> logical |
|
|
( id1 EQual id2 ) |
-> logical |
|
|
( pos1 EQual pos2 ) |
-> logical |
|
|
( dir1 EQual dir2 ) |
-> logical |
|
|
( ori1 EQual ori2 ) |
-> logical |
|
|
( pp1 EQual pp2 ) |
-> logical |
|
|
( number1 NEqual number2 ) |
-> logical |
|
|
( text1 NEqual text2 ) |
-> logical |
|
|
( log1 NEqual log2 ) |
-> logical |
|
|
( id1 NEqual id2 ) |
-> logical |
|
|
( pos1 NEqual pos2 ) |
-> logical |
|
|
( dir1 NEqual dir2 ) |
-> logical |
|
|
( ori1 NEqual ori2 ) |
-> logical |
|
|
( pp1 NEqual pp2 ) |
-> logical |
|
|
Description |
Compare two values. A special feature is used for the positions, only the coordinates specified are compared. Refer to Comparing Positions for further information. Unset values result in FALSE across EQ, TRUE across NE. |
|
|
Side Effects |
If two positions have no common coordinate, for example, ’N 10 ne U 10’, the result is undefined. Units are consolidated across comparisons. |
|
|
Example |
( 1.0 eq 2.0) -> FALSE |
|
|
Errors |
None. |
|
GT, GE, LE and LT
|
Synopsis |
( number1 GT number2 ) |
> logical |
|
( pos1 GT pos2 ) |
> logical |
|
|
( number1 GE number2 ) |
> logical |
|
|
( pos1 GE pos2 ) |
> logical |
|
|
( number1 LE number2 ) |
> logical |
|
|
( pos1 LE pos2 ) |
> logical |
|
|
( number1 LT number2 ) |
> logical |
|
|
( pos1 LT pos2 ) |
> logical |
|
|
Description |
Compare two values. A special feature is used for positions: only the coordinates specified are compared. Refer to Comparing Positions for further information. For positions, since comparisons may be performed on more than one value, LT (GT) is not the inverse of GE (LE). Unset values result in false. |
|
|
Side Effects |
If two positions have no common coordinate, the result is undefined. For example, ’N 10 gt U 10’. Units are consolidated across comparisons. |
|
|
Example |
( 1.0 LT 2.0) -> TRUE ( N 0 E 10 GT N 10 E 0 ) -> FALSE ( N 0 E 10 GT N 10 E 0 ) -> FALSE |
|
|
Errors |
None. |
|
NOT
|
Synopsis |
NOT log1 |
-> logical |
|
Description |
Perform the logical NOT on a logical value. |
|
|
Side Effects |
None. |
|
|
Example |
not TRUE -> FALSE |
|
|
Errors |
None. |
|
OR
|
Synopsis |
OR log2 |
-> logical |
|
Description |
Perform the logical inclusive OR between two logical values. (The exclusive OR is defined by using NE.) Allows numbers instead of logical values. |
|
|
Side Effects |
If one of the values is undefined and the other one is TRUE, the result is TRUE. |
|
|
Example |
TRUE or FALSE -> TRUE |
|
|
Errors |
None. |
|