FQL function reference
All Flows Query Language (FQL) functions are documented below.
Logical Operators
and
Returns true if all provided conditions are true. In the example below, value1 has a value of 20.
or
Returns true if at least one of the provided conditions is true. In the example below, value1 has a value of 20.
General functions
assert
Throws an error with the message if a condition is false.
average
Returns the average value of a numeric array.
boolean
Casts an argument to its effective boolean value.
contains
Returns true if a string contains a pattern.
decodeUrl
Decodes a string from a URL.
decodeUrlComponent
Decodes a string from a component created with encodeUrlComponent.
each
Applies a function to each key/value pair of an object.
encodeUrl
Encodes a value into a URL.
encodeUrlComponent
Encodes a value into a component for a URL.
eval
Evaluates an expression.
exists
Returns true if a value isn’t null or undefined.
filter
Returns an array of elements which satisfy the predicate defined in a function.
join
Joins the elements of an array into a string using the optional separator string.
json
Converts an object to a JSON string.
jsonParse
Parses a JSON string into an object.
keys
Returns an array of the keys in an object.
length
Returns the length of a string.
lookup
Returns the value of a key in an object.
lowercase
Returns the lowercase version of a string.
map
Maps each element of an array using a function and returns a new array with all the mapped elements.
max
Returns the maximum value from a numeric array.
match
Returns an array of strings that match a pattern.
merge
Returns a new object with the properties of each object in an array of objects merged into it.
not
Returns true if a value is false, or false otherwise.
pad
Returns a copy of a string padded to a length with $pad (if provided).
partition
Partitions an array into an array of arrays of size $n.
replace
Returns a string with all occurrences of a pattern replaced by a replacement string.
reduce
Reduces an array to some value using a function.
split
Splits a string into an array of strings using a pattern.
string
Returns the string representation of the input value. If $prettify is true, the output string is formatted for readability.
substring
Returns a substring of a string starting at length (if provided).
substringAfter
Returns the substring of a string after the first occurrence of a separator.
substringBefore
Returns the substring of a string before the first occurrence of a separator.
sum
Returns the sum of the values of a numeric array.
trim
Returns a copy of a string with leading and trailing whitespace removed.
type
Returns the type of a value.
uppercase
Returns the uppercase version of a string
uuid
Returns a unique ID (UUID version 4) as a string.
Array functions
append
Returns a new array with a value appended (added) to an array.
count
Returns the number of elements in an array.
distinct
Returns a new array with the distinct elements of $arr with duplicates eliminated.
reverse
Returns a new array with the elements of an array in reverse order.
shuffle
Returns a new array with the elements of an array in random order.
sort
A higher-order function that sorts the elements of an array using the $swapFn function. The comparator function takes two arguments. If it returns true, the elements will be swapped.
zip
Takes two or more arrays and convolves (zips) each value from a set of arrays.
Numeric functions
abs
Returns the absolute value of a number.
acos
Returns the arc cosine of a number of radians. The result is between 0 and pi. The number must be between —1 and 1.
acosh
Returns the inverse hyperbolic cosine of a number, in radians. The number must be number between 1 and inf. The result is between 0 and inf.
asin
Returns the arc sine of a number of radians. The result is between -pi/2 and pi/2. The number must be between -1 and 1.
asinh
Returns the inverse hyperbolic sine of a number, in radians. The result is between -inf and inf.
atan
Returns the arc tangent of a number of radians. The result is between -pi/2 and pi/2.
atanh
Returns the inverse hyperbolic tangent of a number, in radians. The number must be between -1 and 1. The result is between -inf and inf.
atan2
Returns atan(y / x), in radians. The result is between -pi and pi. The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis. The signs of both inputs are known to it, so it can compute the correct quadrant for the angle. For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.
cbrt
Returns the cube root of a number.
ceil
Returns the smallest integer greater than or equal to a number.
constant
Returns the constant value with the given name. For example: e, ln 2, log2 e, log10 e, pi, or π.
cos
Returns the cosine of a number of radians.
cosh
Returns the hyperbolic cosine of a number of radians.
exp
Returns e raised to the power of a number, where e = 2.718281… is the base of natural logarithms.
floor
Returns the largest integer less than or equal to a number.
formatBase
Converts a number to a string in the optional base number system, if a base isn’t supplied, base 10 is used to create the string.
isFinite
Returns true if the value input isn’t infinity, and false otherwise.
log
Returns the natural logarithm of a number (base e).
log10
Returns the base 10 logarithm of a number.
log2
Returns the base 2 logarithm of a number.
number
Converts a value to a number.
power
Returns exp power.
round
Rounds a number to the optional precision number of decimal places. If precision is negative, then its value specifies which column to round to on the left side of the decimal place.
sin
Returns the sine of a number of radians.
sinh
Returns the hyperbolic sine of a number of radians.
sqrt
Returns the square root of a number.
tan
Returns the tangent of a number of radians.
tanh
Returns the hyperbolic tangent of a number of radians.
Date and time functions
afterDate
Returns true if timestamp2, false otherwise.
beforeDate
Returns true if timestamp2, false otherwise.
dateEquals
Returns true if the two timestamps are the same, false otherwise.
datePlus
Adds a duration of type timestamp and returns the new timestamp. If timestamp.
day
Extracts the day from a timestamp and returns it as a number.
dayOfTheWeek
Returns the day of the week as a number.
diffDate
Returns the difference between two timestamps in the units specified which can be one of [“years”, “months”, “days”, “hours”, “minutes”, “seconds”, “milliseconds”].
fromMillis
Converts a number of milliseconds since the epoch to a string. $picture is optional, if not provided it will default to ISO format. Picture specs are as per Unicode date format standards.
hasSameDate
Returns true if the components specified in units is an array with one or more strings from [“years”, “months”, “days”, “hours”, “minutes”, “seconds”, “milliseconds”].
hours
Extracts the local hour component from a timestamp and returns it as a number.
milliSeconds
Extracts the milliseconds from a timestamp and returns it as a number.
minutes
Extracts the minutes component from a timestamp and returns it as a number.
month
Extracts the month component from a timestamp.
seconds
Extracts the local seconds component from a timestamp and returns it as a number.
toMillis
Converts a string to a number of milliseconds since the epoch. $picture is optional, if not provided it will default to ISO format. Picture specs are as per Unicode date format standards.
year
Extracts the year component from a timestamp and returns it as a number.