A literal represents a constant value of a built-in data type. Some, but not all, data types can be expressed as literals.
String literals
String literals must be quoted
, either with single ( '
) or double ( "
) quotation marks.
Quoted literals:
-
"abc" -
"it's" -
'it\'s' -
'Title: "Boy"'
- Quoted strings enclosed by single (
') quotes can contain unescaped double (") quotes, as well as the inverse. - Backslashes (
\) introduce escape sequences. See the Escape sequences for string literals section. - Quoted strings cannot contain newlines, even when preceded by a backslash (
\).
-
R"abc+" -
r'f\(abc,(.\*),def\)'
- Quoted literals that have the raw string literal prefix (
rorR) are interpreted as raw/regex strings. - Backslash characters (
\) do not act as escape characters. If a backslash followed by another character occurs inside the string literal, both characters are preserved. - A raw string cannot end with an odd number of backslashes.
- Raw strings are useful for constructing regular expressions.
Escape sequences for string literals
The following table lists all valid escape sequences for representing non-alphanumeric characters in string literals. Any sequence not in this table produces an error.
\a
\b
\f
\n
\r
\t
\v
\\
\
)\?
?
)\"
"
)\'
'
)\\`
\`
)\ooo
\xhh
or \Xhh
-
'\x41'=='A' -
'\x41B'is'AB' -
'\x4'is an error
\uhhhh
\Uhhhhhhhh
Date literals
To use literal date and time values in a calculated field, you can precede the value with the appropriate marker:
| Literal | Canonical date format | Sample usage |
|---|---|---|
|
Date
|
YYYY-[M]M-[D]D | DATE '2021-4-1'
|
|
Date and time
|
YYYY-[M]M-[D]D [[H]H:[M]M:[S]S] | DATETIME '2021-5-29 23:59:59'
|
Numeric literals
Enter numeric literals using unquoted integer or floating point values. For example:
-
2 + 2 -
CASE WHEN Cost > 100 THEN...
-
SQRT(3.14) -
FLOOR(-42.123)
Boolean literals
Use the literal values true
and false
when evaluating Boolean expressions. For example:
IF( Boolean field
= true, "yes","no")
IF( Boolean field
= false, "no","yes")
IF( Boolean field
, "yes","no")
IF(not Boolean field
, "yes","no")

