Predicate Functions
Spectre predicate functions determine whether an expression is true or false and return a boolean value.
For example:
all(value("Patient Type") = "Inpatient") returns true if every patient in the current working set is an inpatient.
For example:
`and(true, false, true)` returns false
`and(true, true, true)` returns true
`and(value("Class")="Sedative",value("Schedule")="IV") returns true for sedatives in schedule 4
For example:
Assuming the following:
dimension "State" {
group "New England" "ME" "VT" "NH" "MA" "CT" "RI"
}
Then`group("State", "New England")` when "State" is "ME", returns true; when "State" is "TX", returns false.
is_error(value : any) : boolean
For example:
`is_in("green", "red", "green", "blue")` returns true
`is_in("yellow", "red", "green", "blue")` returns false
For example:
`is_in_list("green", "red, green, blue")` returns true
`is_in_list("green", "red|green|blue", "\\\\|")` returns true
`is_in_list("yellow", "red, green, blue")` returns false
For example:
is_null(value("Cost")) returns false if the Cost column has data
`is_null("")` returns true
`is_null(0)` returns false
NOTE:
- Do not test for a null with string(value("Date")) = ""; instead use is_null(value("Date")).
- In general, do not test for null with `string(...) = ""` ; instead use `isnull(...)`.
For example:
isnull(value("Cost")) returns false if the Cost column has data
`isnull("")` returns true
`isnull(0)` returns false
NOTE:
- Do not test for a null with string(value("Date")) = ""; instead use isnull(value("Date")).
- In general, do not test for null with `string(...) = ""` ; instead use `isnull(...)`.
For example:
`or(false, true, false)` returns true
`or(false, false, false)` returns false
For example:
some(year(value("Ship Date")) = 2017) returns true if any record in the current working set has a Ship Date in 2017
A function that creates the opposite boolean result of its condition.
not(condition : boolean) : boolean
The not() function is not an actual function. It is parsed as a NOT unary operator and does not need to be written as a function. For example:
not(value("Year") = 2017) is the same as not value("Year") = 2017. If the value referenced is 2017, the function returns false, otherwise the function returns true.
See also: Alphabetized Functions for Spectre.