Logical Functions
- Last UpdatedNov 13, 2025
- 5 minute read
The logical functions available are:
|
BADREF |
|
|
DEFINED,UNDEFINED |
|
|
CREATED |
|
|
DELETED |
|
|
EMPTY |
|
|
IFTRUE |
|
|
MATCHWILD |
|
|
MODIFIED |
|
|
UNSET |
|
|
VLOGICAL |
BADREF
|
Synopsis |
BADREF (id) |
-> logical |
|
Description |
TRUE if id is invalid, else FALSE. |
|
|
Side Effects |
None |
|
|
Example |
BADREF(TREF) -> ’true’ if TREF=nulref |
|
|
Errors |
None. |
|
DEFINED and UNDEFINED
|
Synopsis |
DEFined (variable_name) |
-> logical |
|
DEFined (variable_name,number) |
-> logical |
|
|
UNDEFined (variable_name) |
-> logical |
|
|
UNDEFined (variable_name , number) |
-> logical |
|
|
Description |
With one argument, DEFINED is true only if the scalar variable, the array variable or the array variable element exists. With two arguments, DEFINED is true only if the first argument is an array variable which has a value for the index denoted by the second argument. UNDEFINED( !foo ) is equivalent to NOT DEFINED( !foo ). |
|
|
Side Effects |
None. |
|
|
Example |
DEFINED ( !var ) -> TRUE DEFINED ( !array ) -> TRUE DEFINED ( !array[1] )) -> TRUE DEFINED ( !array , 1 ) -> TRUE DEFINED ( !var) -> FALSE UNDEFINED ( !array) -> TRUE DEFINED ( !array , 3 ) -> FALSE |
|
|
Errors |
None. |
|
CREATED
|
Synopsis |
CREATED |
-> logical |
|
Description |
Returns TRUE if the element has been created since the set date. |
|
|
Side Effects |
None. |
|
|
Example |
CREATED -> TRUE |
|
|
Errors |
None. |
|
DELETED
|
Synopsis |
DELETED |
-> logical |
|
Description |
Returns TRUE if the element has been deleted since the set date. |
|
|
Side Effects |
None. |
|
|
Example |
DELETED -> TRUE |
|
|
Errors |
None. |
|
EMPTY
|
Synopsis |
EMPTY(text) |
-> logical |
|
Description |
Returns TRUE if text is a zero length string, else FALSE |
|
|
Side Effects |
None. |
|
|
Example |
EMPTY(‘’) -> TRUE EMPTY(‘not empty’) -> FALSE |
|
|
Errors |
None. |
|
IFTRUE
|
Synopsis |
IFTrue(logical, anyA, anyB) |
-> logical |
|
The first argument is a logical value or expression. The second and third arguments may be of any type BUT THEY MUST BE OF THE SAME TYPE. Returns a value that is the SAME TYPE as the second and third arguments. |
||
|
Description |
Returns anyA if logical evaluates to TRUE, anyB if logical evaluates to FALSE. anyA and anyB can be IFTRUE functions themselves (as long as they return consistent types) so IF constructs can be nested.ds. |
|
|
Side Effects |
None. |
|
|
Example |
IFT (SPREF EQ /A3B/GC50, 'BLUE', 'RED' iftrue (gwei gt 1tonne, /INSUL/THICK, /INSUL/THIN) |
-> BLUE ->INSUL/THICK |
|
Errors |
Normal number of argument errors and Mismatched second and third arguments: (2,497) TYPE MISMATCH: unmatched or illegal argument type for IFTRUE function. |
|
MATCHWILD
|
Synopsis |
MATCHW/ILD( text1, text2) |
-> logical |
|
MATCHW/ILD( text1, text2, text3) |
-> logical |
|
|
MATCHW/ILD( text1, text2, text3, text4) |
-> logical |
|
|
Description |
Matches string text2 to string text1. If they are the same then returns TRUE, else FALSE. text2 may contain wildcard characters. The defaults for wildcards are ‘*’ for any number of characters, and ‘?’ for a single character. With three arguments, the multiple wildcard character ‘*’ may be redefined by text3. With four arguments the single wildcard character ‘?’ may be redefined by text4. |
|
|
Side Effects |
None |
|
|
Example |
MATCHW/ILD(’A big bottle of beer’,’*big*’) -> TRUE MATCHW/ILD(’A big bottle of beer’,’??big*’) -> TRUE MATCHW/ILD(’A big bottle of beer’,’???*big*’) -> FALSE MATCHW/ILD(’A big bottle of beer’,’*big*beer’) -> TRUE MATCHW/ILD(’** text’,’**!’,’!’) -> TRUE |
|
|
Errors |
None. |
|
MODIFIED
|
Synopsis |
||
|
.-----------------------------------. / | >- MODIFIED-(-+- attname -------*- DESCENDANTS ‑-+-+-comma +-attname ‑’ | | | | |- DESCENDANTS -. |- SIGNIFICANT --| | | | | | | |- SIGNIFICANT--| |- PRIMARY ----- | | | | | | | |- PRIMARY -----| |- OFFSPRING-----| | | | | | | |- OFFSPRING ---| ‘----------------’ | | | | | | | | | | ‘---------------+--------------------+--+-- ) - OF ‑ id Æ | ‘-Æ |
||
|
Description |
For sophisticated queries relating to modifications. Returns TRUE if a modification has taken place. Each attribute name may be followed by the following qualifying keywords: OFFSPRING, to check this element and members |
|
|
SIGNIF, to check all elements for which this element represents the significant one; PRIMARY, check all elements for which this element represents the primary one; |
||
|
DESCENDANTS, this element and everything below (descendants). The ‘OF’ syntax may be used as for attributes. |
||
|
The MODIFIED function or the GEOM, CATTEXT and CATMOD pseudo-attributes. |
||
|
The MODIFIED, DELETED and CREATED functions may go anywhere within an AVEVA E3D Design PML1 expression (that is, after Q/VAR and within collections). |
||
|
Side Effects |
None |
|
|
Example |
Q (MODIFIED()) |
Returns TRUE if element has changed at all since the comparison date. It will also return TRUE if the element has been created since the comparison date. |
|
Q MODIFIED(POS,ORI) |
Returns TRUE if POS or ORI modified since the comparison date. |
|
|
Q MODIFIED(P1 POS) |
Returns TRUE if the position of P1 has changed. |
|
|
Q MODIFIED(GEOM DESCENDANTS |
Returns TRUE if any geometry for item or any descendants has changed |
|
|
Q MODIFIED(PRIMARY) |
Returns TRUE if any element for which this element is primary, has changed. |
|
|
Q MODIFIED() OF /PIPE1 |
Returns TRUE if /PIPE1 has been modified since the comparison date. |
|
|
Q (BUIL OR MODIFIED()OR ELECREC OF NEXT ) |
||
|
Errors |
None. |
|
The MODIFIED, DELETED and CREATED functions are not implemented within PML2 expressions.
UNSET
|
Synopsis |
UNSET(value) |
-> logical |
|
|
Description |
Returns TRUE if value is unset, else FALSE. The value can be of any data type including ARRAYS. Normally it will be an AVEVA E3D™ attribute. |
||
|
Side Effects |
None. |
||
|
Example |
UNSET( DESC ) |
TRUE where DESC is an unset text attribute |
|
|
UNSET(CRFA) |
FALSE where CRFA contains unset reference attributes |
||
|
Errors |
None. |
||
VLOGICAL
VLOGICAL is used for the late evaluation of variables.
|
Synopsis |
VLOGICAL ( variable_name )) |
-> logical |
|
VLOGICAL ( variable_name , number) |
-> logical |
|
|
Description |
With one argument, return the value of the scalar variable or the value of the array variable element as a logical. With two arguments, return the value of the element corresponding to the index number as a logical. The rules of conversion are: TRUE for the strings ’T’, ’TR’, ’TRU’ or ’TRUE’ (case insensitive) or any numeric value not equal to zero; FALSE for the strings ’F’, ’FA’, ’FAL’, ’FALS’ or ’FALSE’ (case insensitive) or a numeric value equal to zero. Scalar variables may not be indexed. For example, VTEXT(!var[1]) will return an error. Array variables must have an index. For example, VTEXT (!array) will return an error. The value cannot be translated into a logical. See also VTEXT, used for late evaluation when a text result is required; and VVALUE, used for late evaluation when a numeric result is required. |
|
|
Side Effects |
If the scalar variable, the array variable, or the array variable element does not exist, the result is undefined. |
|
|
Example |
VLOG ( !array[1] ) -> TRUE VLOG ( !array , 2 ) -> FALSE |
|
|
Errors |
None. |
|