Logical Functions
- Last UpdatedMar 28, 2023
- 4 minute read
The logical functions available are:
|
Function |
Comments |
|---|---|
|
BADREF |
|
|
DEFINED,UNDEFINED |
|
|
CREATED |
|
|
DELETED |
|
|
EMPTY |
|
|
MATCHWILD |
|
|
MODIFIED |
|
|
UNSET |
|
|
VLOGICAL |
BADREF
|
Synopsis |
BADREF (id) |
-> logical |
|
Description |
TRUE if id is invalid, otherwise 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, otherwise FALSE. |
|
|
Side Effects |
None. |
|
|
Example |
EMPTY(‘’) -> TRUE EMPTY(‘not empty’) -> FALSE |
|
|
Errors |
None. |
|
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, otherwise 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:
The OF syntax may be used as for attributes. The MODIFIED function or the GEOM, CATTEXT, and CATMOD pseudo-attributes can be used instead of the AFTERDATE function.Refer to Pseudo Attributes for further information. |
|
|
The MODIFIED, DELETED, and CREATED functions may go anywhere within a PML1 expression, as in, 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, otherwise FALSE. The value can be of any data type including ARRAYS. Normally, it will be a 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:
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. |
|