Workflows

Expression functions

All inline expression functions — text, dates, math, logic, conversion, lists, regex, data and files — with signatures and examples.

Use these inside {{= … }} in any setting. Optional arguments are in brackets. The list is generated from the expression engine (lib/expression-functions.ts).

Text functions

FunctionReturnsDescriptionExample
LEFT(text, length)stringGet characters from the left of a stringLEFT("Example", 2) → "Ex"
RIGHT(text, length)stringGet characters from the right of a stringRIGHT("Example", 3) → "ple"
MID(text, start, [length])stringGet a substring starting at a positionMID("Example", 3, 2) → "am"
LENGTH(text)numberGet the length of a stringLENGTH("Hello") → 5
UPPER(text)stringConvert to uppercaseUPPER("hello") → "HELLO"
LOWER(text)stringConvert to lowercaseLOWER("HELLO") → "hello"
TRIM(text)stringRemove leading/trailing whitespaceTRIM(" hi ") → "hi"
REPLACE(text, find, replace)stringReplace occurrences in a stringREPLACE("hello", "l", "r") → "herro"
FIND(text, search)numberFind position of substring (1-based, 0 if not found)FIND("Example", "amp") → 3
CONTAINS(text, search)booleanCheck if string contains a substringCONTAINS("hello", "ell") → true
CONCAT(values)stringConcatenate multiple valuesCONCAT("a", " ", "b") → "a b"
JOIN(separator, values)stringJoin a list with a separatorJOIN(", ", "a", "b") → "a, b"
SPLIT(text, separator)arraySplit text into a listSPLIT("a;b;c", ";") → ["a","b","c"]
PAD_LEFT(text, length, [char])stringPad string on the leftPAD_LEFT("5", 3, "0") → "005"
PAD_RIGHT(text, length, [char])stringPad string on the rightPAD_RIGHT("5", 3, "0") → "500"
PROPER(text)stringConvert to title casePROPER("hello world") → "Hello World"
URL_ENCODE(text)stringURL-encode a stringURL_ENCODE("a b") → "a%20b"
URL_DECODE(text)stringURL-decode a stringURL_DECODE("a%20b") → "a b"

Date & Time functions

FunctionReturnsDescriptionExample
NOW()stringCurrent date and timeNOW() → "2024-03-15T14:30:00"
TODAY()stringCurrent date (midnight)TODAY() → "2024-03-15"
ADD_DAYS(date, days)stringAdd days to a dateADD_DAYS("2024-01-01", 7) → "2024-01-08"
ADD_HOURS(date, hours)stringAdd hours to a date/timeADD_HOURS(NOW(), 2)
ADD_MINUTES(date, minutes)stringAdd minutes to a date/timeADD_MINUTES(NOW(), 30)
SUBTRACT_DAYS(date, days)stringSubtract days from a dateSUBTRACT_DAYS("2024-01-08", 7) → "2024-01-01"
DAY_DIFF(date1, date2)numberDays between two datesDAY_DIFF("2024-01-01", "2024-01-08") → 7
DAY(date)numberGet day of monthDAY("2024-03-15") → 15
MONTH(date)numberGet month numberMONTH("2024-03-15") → 3
YEAR(date)numberGet yearYEAR("2024-03-15") → 2024
WEEKDAY(date)stringGet day of week nameWEEKDAY("2024-03-15") → "Friday"
FORMAT_DATE(date, format)stringFormat a date stringFORMAT_DATE(NOW(), "YYYY-MM-DD")
START_OF_MONTH(date)stringFirst day of the monthSTART_OF_MONTH("2024-03-15") → "2024-03-01"
END_OF_MONTH(date)stringLast day of the monthEND_OF_MONTH("2024-03-15") → "2024-03-31"
TOMORROW()stringTomorrow's dateTOMORROW() → "2024-03-16"
YESTERDAY()stringYesterday's dateYESTERDAY() → "2024-03-14"

Math functions

FunctionReturnsDescriptionExample
ABS(number)numberAbsolute valueABS(-5) → 5
ROUND(number, [digits])numberRound to precisionROUND(1.567, 1) → 1.6
ROUND_UP(number)numberRound up (ceiling)ROUND_UP(1.1) → 2
ROUND_DOWN(number)numberRound down (floor)ROUND_DOWN(1.9) → 1
MIN(values)numberMinimum of valuesMIN(3, 1, 5) → 1
MAX(values)numberMaximum of valuesMAX(3, 1, 5) → 5
AVG(values)numberAverage of valuesAVG(2, 4, 6) → 4
SUM(values)numberSum of valuesSUM(1, 2, 3) → 6
POWER(base, exponent)numberRaise to a powerPOWER(2, 3) → 8
SQRT(number)numberSquare rootSQRT(9) → 3
MOD(number, divisor)numberModulo (remainder)MOD(10, 3) → 1
RANDOM(max)numberRandom number 0 to maxRANDOM(100) → 42
FORMAT_NUMBER(number, decimals)stringFormat number with decimalsFORMAT_NUMBER(1234.5, 2) → "1234.50"

Logical functions

FunctionReturnsDescriptionExample
IF(condition, then, else)anyIf condition then A else BIF(true, "Yes", "No") → "Yes"
AND(values)booleanTrue if all values are trueAND(true, true) → true
OR(values)booleanTrue if any value is trueOR(true, false) → true
NOT(value)booleanNegate a booleanNOT(true) → false
COALESCE(values)anyFirst non-empty valueCOALESCE("", null, "hi") → "hi"
IS_EMPTY(value)booleanCheck if value is empty/nullIS_EMPTY("") → true

Conversion functions

FunctionReturnsDescriptionExample
TO_STRING(value)stringConvert to stringTO_STRING(123) → "123"
TO_NUMBER(value)numberConvert to numberTO_NUMBER("42") → 42
TO_BOOLEAN(value)booleanConvert to booleanTO_BOOLEAN("true") → true
TO_JSON(value)stringConvert to JSON stringTO_JSON({a:1}) → '{"a":1}'
FROM_JSON(text)anyParse a JSON stringFROM_JSON('{"a":1}') → {a:1}

List functions

FunctionReturnsDescriptionExample
COUNT(list)numberCount items in a listCOUNT([1,2,3]) → 3
FIRST(list)anyFirst item in a listFIRST([1,2,3]) → 1
LAST(list)anyLast item in a listLAST([1,2,3]) → 3
INDEX(list, index)anyGet item at index (1-based)INDEX([a,b,c], 2) → "b"
REVERSE(list)arrayReverse a listREVERSE([1,2,3]) → [3,2,1]
UNIQUE(list)arrayRemove duplicate valuesUNIQUE([1,2,2,3]) → [1,2,3]
FLATTEN(list)arrayFlatten nested arraysFLATTEN([[1,2],[3]]) → [1,2,3]
PLUCK(list, key)arrayExtract one field from every item into a list (dotted paths like "address.city" work)SUM(PLUCK(items, "price"))
FIND_WHERE(list, field, value, [return_field])anyFirst item whose field equals a value — optionally return one field of itFIND_WHERE(customers, "id", 42, "email") → "ada@example.com"
FILTER_WHERE(list, field, value)arrayAll items whose field equals a valueCOUNT(FILTER_WHERE(orders, "status", "open"))

Regex functions

FunctionReturnsDescriptionExample
REGEX_MATCH(text, pattern)booleanTest if text matches a patternREGEX_MATCH("abc123", "\\d+") → true
REGEX_EXTRACT(text, pattern)stringExtract first matchREGEX_EXTRACT("abc123", "\\d+") → "123"
REGEX_REPLACE(text, pattern, replacement)stringReplace matches with a stringREGEX_REPLACE("a1b2", "\\d", "X") → "aXbX"

Data functions

FunctionReturnsDescriptionExample
GUID()stringGenerate a new UUIDGUID() → "a1b2c3..."
BASE64_ENCODE(text)stringEncode string to Base64BASE64_ENCODE("Hello") → "SGVsbG8="
BASE64_DECODE(text)stringDecode Base64 to stringBASE64_DECODE("SGVsbG8=") → "Hello"

File functions

FunctionReturnsDescriptionExample
FILE_NAME(path)stringExtract filename from path or URLFILE_NAME("/docs/report.pdf") → "report.pdf"
FILE_EXT(path)stringExtract file extensionFILE_EXT("report.pdf") → "pdf"
FILE_BASE_NAME(path)stringFilename without extensionFILE_BASE_NAME("report.pdf") → "report"
MIME_TYPE(filename)stringGet MIME type from extensionMIME_TYPE("doc.pdf") → "application/pdf"
FILE_SIZE_FORMAT(bytes)stringFormat bytes to human-readableFILE_SIZE_FORMAT(1048576) → "1.0 MB"
DATA_URI(base64, mimeType)stringBuild data URI from base64 + mimeDATA_URI("SGVs...", "text/plain")
DATA_URI_BASE64(dataUri)stringExtract base64 from a data URIDATA_URI_BASE64("data:text/plain;base64,SGVs...") → "SGVs..."
DATA_URI_MIME(dataUri)stringExtract MIME type from a data URIDATA_URI_MIME("data:text/plain;base64,...") → "text/plain"