Rule functions — gull system handbook
Reference list of the gull system rule language functions: logical, mathematical, trigonometric, text, list, table and check functions, with arguments and meaning.
Rule functions
Every function of the rule language by category, as the Functions button offers them. Case does not matter; an optional argument is marked with a question mark.
An argument with a question mark is optional, an ellipsis means any number. How to pick and insert a function is in Write a rule on a parameter; value notation and operators in The rule language.
Logical
- Function: `IF(condition, if_true, if_false)` - Meaning: Returns one of two values; only the chosen branch is evaluated.
- Function: `IFERROR(value, fallback)` - Meaning: Returns the value, or the fallback when it is an error.
- Function: `CHOOSE(index, value…)` - Meaning: Picks a value by position (1 = first).
- Function: `CHOOSEFROM(input, default, when, then, …)` - Meaning: A switch: the first matching value returns the result next to it. Text is compared exactly.
- Function: `AND(condition…)`, `OR(condition…)`, `NOT(condition)` - Meaning: All / at least one / the opposite.
- Function: `TRUE()`, `FALSE()` - Meaning: Boolean constants.
Mathematical
- Function: `ABS(number)`, `SIGN(number)`, `SQRT(number)` - Meaning: Absolute value, sign, square root (a negative gives `#NUM!`).
- Function: `MIN(number…)`, `MAX(number…)` - Meaning: Smallest, largest.
- Function: `ROUND(number, places)` - Meaning: Rounds, half away from zero; negative places round to tens, hundreds.
- Function: `ROUNDUP(number, places)`, `ROUNDDOWN(number, places)` - Meaning: Away from zero / towards zero.
- Function: `INT(number)` - Meaning: Rounds down.
- Function: `MOD(number, divisor)` - Meaning: Remainder; the sign follows the divisor.
- Function: `CEILING(number, multiple)`, `FLOOR(number, multiple)` - Meaning: To the nearest multiple up / down. Both arguments are required.
- Function: `POWER(base, exponent)`, `PI()` - Meaning: Power, π.
Trigonometric
- Function: `SIN`, `COS`, `TG`, `COTG`, `ASIN`, `ACOS`, `ATG`, `ACOTG` - Meaning: In radians. `TAN`, `COT`, `ATAN`, `ACOT` are aliases.
- Function: `SIND`, `COSD`, `TGD`, `COTGD`, `ASIND`, `ACOSD`, `ATGD`, `ACOTGD` - Meaning: In degrees. The unit is in the function's name; the per-rule degrees/radians switch is gone.
Text
- Function: `LEFT(text, count?)`, `RIGHT(text, count?)`, `MID(text, start, count)` - Meaning: Part of a text; count defaults to 1.
- Function: `LEN(text)`, `UPPER`, `LOWER`, `PROPER`, `TRIM` - Meaning: Length, upper, lower, capitalised, without outer and doubled spaces.
- Function: `FIND(needle, in_text, from?)`, `SEARCH(…)` - Meaning: Position of a text; FIND is case-sensitive, SEARCH is not. Not found gives `#VALUE!`. No wildcards.
- Function: `SUBSTITUTE(text, old, new, occurrence?)`, `REPLACE(text, start, count, new)` - Meaning: Replace by text / by position.
- Function: `REPT(text, times)`, `CONCATENATE(text…)`, `EXACT(a, b)` - Meaning: Repeat, join (same as `&`), exact comparison.
- Function: `TEXT(number, format)` - Meaning: Formats `0`, `0.00`, `000`, with a prefix or suffix (`"$0.00"`). The output always has a decimal point.
- Function: `VALUE(text)` - Meaning: Text to number; expects a decimal point.
Lists (pipe-separated text)
- Function: `LISTCOUNTITEMS(list)`, `LISTGETITEM(list, index)` - Meaning: Item count, item by position.
- Function: `LISTFINDITEM(list, item)` - Meaning: An item's position regardless of case; `#NA!` when missing.
- Function: `LISTSORT(list, ascending?)`, `LISTREMOVEDUPLICATES(list)` - Meaning: Numbers before text; duplicates are matched exactly.
Tables (columns and rows from 1, row 1 of a table is the header)
- Function: `VLOOKUP(value, table, column, approximate)` - Meaning: Searches the first column. The fourth argument is required: `FALSE` exact, `TRUE` nearest.
- Function: `DWVLOOKUP(value, table, search_column, column, approximate)` - Meaning: Searches any column.
- Function: `HLOOKUP(value, table, row, approximate)`, `DWHLOOKUP(…)` - Meaning: The same by rows.
- Function: `TABLECOLUMNLOOKUP(value, search_column, result_column, not_found?, mode?, direction?)` - Meaning: Both columns are single-column tables. Mode `"EXACT"`, `"NEAREST"`, `"NEAREST_SMALLER"`, `"NEAREST_LARGER"`; direction `"FORWARD"`, `"REVERSE"`.
- Function: `TABLEGETVALUE(table, column?, row?)` - Meaning: A cell; row 1 is the first data row, defaults 1 and 1.
- Function: `GETTABLEVALUE(table, row, column)` - Meaning: The same with the row first.
- Function: `TABLEGETCOLUMNINDEXBYNAME(table, name, ignore_case?)` - Meaning: A column's number by its header.
- Function: `TABLEGETROWCOUNT(table)`, `TABLEGETCOLUMNCOUNT(table)` - Meaning: Row count (header included) and column count.
- Function: `TABLESELECTCOLUMNS(table, column…)` - Meaning: The table with only the chosen columns, header kept.
- Function: `TABLEFILTER(table, column, condition, no_blanks?)` - Meaning: The rows meeting the condition, header kept.
- Function: `LISTALL(table, column, sort?)`, `LISTALLDISTINCT(table, column)` - Meaning: A column as a list — for a field's Items.
- Function: `LISTALLCONDITIONAL(table, column, condition_column, condition, …)`, `LISTALLCONDITIONALDISTINCT(…)` - Meaning: A column as a list, only the rows meeting the conditions — choices that depend on another field.
Checks
- Function: `ISERROR(value)`, `ISNUMBER`, `ISTEXT`, `ISEMPTY` - Meaning: Stop an error and answer TRUE/FALSE; ISEMPTY is true for an empty value and empty text.
Conditions in table functions
A condition is text starting with `=`, `<>`, `<`, `>`, `<=` or `>=`; without a prefix it means equals. The asterisk is a wildcard: `"=Red"`, `">30"`, `"<>A*"`, or built from a field: `"=" & [Colour]`.
A number is matched numerically; text regardless of case but without trimming spaces. The `"NEAREST"` mode needs no sorted table and takes the closest value in either direction.
The function `VZHLED(texture, colour, scale?, angle?)` still runs but is not offered: it is the older notation from when an appearance had one rule. Today it has Colour, Texture and Texture rotation separately — see Connect a finish to the customer's inputs.