You are viewing the documentation for Blueriq 13. Documentation for other versions is available in our documentation directory.
Learn more about the logical functions AND, OR, NOT and logical values TRUE, FALSE, UNKNOWN.
Overview
Function / value | Description |
---|---|
AND | Returns TRUE if all its arguments evaluate to TRUE; it returns FALSE if one or more arguments evaluate to FALSE. |
NOT | Reverses the value of its boolean argument. |
OR | Returns TRUE if at least one of its arguments evaluates to TRUE; it returns FALSE if none of the arguments evaluate to TRUE. |
UNKNOWN | Use the '?' (question mark), representing UNKNOWN, to check if an expression or an attribute has a value. |
TRUE | This is the boolean value TRUE. |
FALSE | This is the boolean value FALSE. |
Functions
AND
Returns TRUE if all its arguments evaluate to TRUE; it returns FALSE if one or more arguments evaluate to FALSE.
Syntax
argument1 AND argument2 [AND ...]
- argument1 - The first boolean condition that you want to evaluate.
- argument2 - The first boolean condition that you want to evaluate.
- [AND …] - Additional boolean conditions that you want to evaluate. (optional)
Return type
- boolean
Examples
Expression | Result | Type |
---|---|---|
TRUE AND TRUE | TRUE | boolean |
TRUE AND FALSE | FALSE | boolean |
TRUE AND ? (= UNKNOWN) | UNKNOWN | boolean |
FALSE AND ? | FALSE | boolean |
OR
Returns TRUE if at least one of its arguments evaluates to TRUE; it returns FALSE if none of the arguments evaluate to TRUE.
Syntax
argument1 OR argument2 [OR ...]
Input
- argument1 - The first boolean condition that you want to evaluate. argument2 - The first boolean condition that you want to evaluate. [OR …] - Additional boolean conditions that you want to evaluate.
Return type
- boolean
Examples
Expression | Result | Type |
---|---|---|
TRUE OR TRUE | TRUE | boolean |
TRUE OR FALSE | TRUE | boolean |
FALSE OR FALSE | FALSE | boolean |
TRUE OR ? (= UNKNOWN) | TRUE | boolean |
FALSE OR ? (= UNKNOWN) | UNKNOWN | boolean |
NOT
Reverses the value of its boolean argument.
Syntax
NOT argument
- argument - The boolean condition of which you want to reverse its value.
Return type
- boolean
Examples
Expression | Result | Type |
---|---|---|
NOT (TRUE) | FALSE | boolean |
NOT (TRUE AND FALSE) | TRUE | boolean |
NOT ( ? (= UNKNOWN) ) | UNKNOWN | boolean |
NOT (NOT (TRUE)) | TRUE | boolean |
Using brackets is not required, but advised to clearly indicate which boolean condition needs to be reversed.
UNKNOWN
Example
Suppose a model with an entity Person and attributes Person.name and Person.age. In runtime, a user fills out a form and enters his name, but forgets to fill out his age.
As a result:
Expression | Result | Type | Reason |
---|---|---|---|
Person.name = ? | FALSE | boolean | This attribute is filled out |
Person.age = ? | TRUE | boolean | This attribute is not filled out, and therefore UNKNOWN |
TRUE
This is the boolean value TRUE.
FALSE
This is the boolean value FALSE.
4 Comments
Unknown User (d.van.der.poel)
I was wondering in what order logical operators are processed. My assumption was AND first, then OR. It seems that it is neither that nor the other way around:
FALSE AND FALSE OR TRUE --> TRUE (consistent with AND first, inconsistent with OR first)
TRUE OR FALSE AND FALSE --> FALSE (consistent with OR first, inconsistent with AND first)
Both: consistent with ( ( A operator B ) operator C )
Edit: corrected a copy-paste error
Unknown User (m.gulpers)
I always learned to use brackets. When omitted, expect anything, even the spanish inquisition.
Rory Tans
In older documentation I saw a comment that there was a operator for exclusive or (Logical functions).
Is there a build in operator or do i still model this like ?
Louis Wouters
You can use ' != ' (does not equal) to perform XOR on two boolean expressions.
Note the difference between using ' != ' as ...
Manual input of ?
Manual input of ?