Cast operators convert one data type into another.
INT Casts the argument to an integer, truncating the value if necessary. The argument is first coerced to a float if possible. Non-numeric values return 0.
# Usage: INT(arg1)
# Examples
INT($price_dollars)
INT(DIV($seconds, 3600))
FLOAT Casts the argument to a float. Non-numeric values return 0.0.
# Usage: FLOAT(arg1)
# Examples
FLOAT($price_dollars) # For example, 300.5
FLOAT("3.1415926535") # 3.1415926535
BOOL Casts the argument to a bool.
Evaluates to true if the argument is truthy:
| source type | value |
BOOL($value) |
|---|---|---|
| int | 0 |
false |
| int | (anything else) | true |
| float | 0.0 |
false |
| float | (anything else) | true |
| string | "true" |
true |
| string | (anything else) | false |
| bool | true |
true |
| bool | false |
false |
nil |
false |
# Usage: BOOL(arg1)
# Examples
BOOL($price_dollars) # For example, true
BOOL("") # false
BOOL(true) # true
STRING Casts the argument to a string.
Empty arguments are converted to "".
# Usage: STRING(arg1)
# Examples
STRING($price_dollars) # "300.5", for example
STRING(true) # "true"
STRING($empty_column) # ""