Built-in functions
This page describes the built-in functions of the Flow Connect platform. Note that additional functions are available in the built-in modules (described in subsequent chapters of this document).
Last updated
Was this helpful?
This page describes the built-in functions of the Flow Connect platform. Note that additional functions are available in the built-in modules (described in subsequent chapters of this document).
Last updated
Was this helpful?
Signature: isNumber(input: primitive) -> boolean
Returns a boolean value indicating whether the input argument can be converted into a number by the function.
Signature: upper(self input: text) -> text
Returns an uppercase version of the input argument.
Signature: lower(self input: text) -> text
Returns an lowercase version of the input argument.
Signature: val(input: text) -> number
The val function will interpret either point or comma as a decimal separator.
Signature: len(self input: text) -> number
Returns the number of characters in the input argument.
Signature: urlEncode(self input: text) -> text
Signature: urlDecode(self input: text) -> text
Signature: chr(input: primitive) -> text
Converts a unicode code point (in decimal format) to the corresponding text value. Inputs must be in the Basic Multilingual Plane of Unicode, otherwise the function will raise an error.
Signature: left(self input: text, count: number) -> text
Returns a specified number of characters taken from the input text, starting from the left. If the number of characters specified by the count
argument exceeds the number of characters in the input, the whole of input will be returned. If count
is zero or less then an empty text will be returned.
Signature: right(self input: text, count: number) -> text
Returns a specified number of characters taken from the input text, starting from the right. If the number of characters specified by the count
argument exceeds the number of characters in the input, the whole of input will be returned. If the count
is zero or less then an empty text will be returned.
Signature: mid(self input: text, index: number, count: number) -> text
Returns a specified number of characters taken from the input text, starting at the position indicated by the index
argument.
If the numbers of the characters specified by the count
argument exceeds the remaining characters after the index, the rest of the text will be returned.
The function will throw an error if the given start index is greater than or equal to the number of characters in the input.
Signature: regexMatch(input: text, pattern: text) -> boolean
Signature: regexMatches(input: text, pattern: text) -> text*
Signature: regexReplace(self input: text, pattern: text, replacement: text ) -> text
Signature: replace(self input: text, search: text, replacement: text ) -> text
Returns a value in which all occurrences of search
in input
are replaced with replacement
.
Signature: trim(self input: text) -> text
Returns the input text with trailing and leading whitespace removed.
Signature: inStr(self source: text, lookFor: text) -> number
Returns the index of the first occurrence of the lookFor
argument in the source
text. If no occurrence exists inside the source
text, the function returns -1.
Signature: guid() -> text
Signature: str(input: any) -> text
Returns a text representation of the input. Null values will be converted to a empty text value.
Signature: rgb(red: number, green: number, blue: number) -> text
Returns the hex code corresponding the RGB color with given values of red
, green
and blue
. The arguments will be rounded to the nearest integer in the range of 0 through 255.
Signature: split(self input: text, delimiter: text ) -> text*
Returns all sub strings of the input argument, separated by the specified delimiter.
If the given delimiter is not present in the input text then a sequence consisting only of the input text will be returned.
The delimiter argument must be exactly one character long.
Signature: splitToTable(self input: text, delimiter: text ) -> {value: text}*
A version of the split function designed for compatiblity with Flow Classic.
Signature: join(self sequence: primitive*, separator: text ) -> text
Concatenates all the text values in the sequence
argument and returns a single text, inserting the separator
between each element.
Signature: format(input: primitive, pattern: text) -> text
Returns a formatted text representation of a given number or datetime input using the given pattern
to format it.
Signature: formatLocale(input: primitive, pattern: text, locale: text) -> text
Returns a formatted text representation of a given number or datetime input using the given pattern and locale to format it.
Signature: encodeText(self input: text, encoding: text) -> binary
Encodes the input text to binary value with the given encoding. Valid values for the encoding
parameter are: iso-8859-1
, utf-8
, utf-16
and utf-32
.
Signature: decodeText(self data: binary, encoding: text) -> binary
Converts a binary value into a text representation using the provided encoding. Valid values for the encoding
parameter are: iso-8859-1
, utf-8
, utf-16
and utf-32
.
Signature: base64Encode(self data: binary) -> text
Signature: base64Decode(self base64: text) -> binary
Converts a base64 encoded text into a binary file.
Signature: isNull<T>(value: T?, replacement: T) -> T
Returns value
if is not null, otherwise returns the replacement
argument.
Signature: isNullOrEmpty(value: text?, replacement: text) -> text
Returns value
if it is not equal to null or the empty string (""); otherwise returns the replacement
argument.
Signature: ceil(input: number) -> number
Rounds input
argument upward to the nearest integer.
Signature: floor(input: number) -> number
Rounds input
downward to the nearest integer.
Signature: random(min: number, max:number) -> number
Generates a pseudo-random number between min
and max
.
Signature: max(a: number, b:number) -> number
Returns the greatest of a
and b
.
Signature: min(a: number, b:number) -> number
Returns the least or a
and b
.
Signature: pow(base: number, exponent: number) -> number
Returns the base
raised to the exponent
.
Signature: round(x: number) -> number
Returns x
rounded to the nearest integer.
Signature: sum(sequence: number?*) -> number
Returns the sum of the numbers in a sequence. Returns 0 if the sequence is empty. Null values count as zero.
Signature: now() -> datetime
Returns a datetime value containing the calendar date and time indicated by the system clock of device on which the FlowScript is running.
Signature: date(input: text) -> datetime
Converts the input argument to a datetime if possible. If the input cannot be converted to a date, the function raises an error.
The date function supports several different date and time formats such as YYYY-MM-DD, ISO 8601 and more.
Signature: toDate(input: text, format: text) -> datetime
Converts the input argument to a datetime with the given format if possible. if the input cannot be converted to a date using the specified format, the function raises an error.
Signature: any(self sequence: unknown*) -> boolean
Returns a boolean value indicating whether the sequence has at least one element.
Signature: count(self sequence: unknown*) -> number
Returns the number of items in a sequence.
Signature: first<T>(self sequence: T*) -> T
Returns the first element from the sequence, or raises an error if the sequence is empty.
Signature: firstOrDefault<T>(self sequence: T*, defaultValue: T) -> T
Returns the first element from the sequence. If the seauence is empty, the function returns the defaultValue
argument.
Signature: firstOrNull<T>(self sequence: T*) -> T?
Returns the first element from the sequence. If the seauence is empty, the function returns null.
Signature: last<T>(self sequence: T*) -> T
Returns the last element from the sequence, or raises an error if the sequence is empty.
Signature: lastOrDefault<T>(self sequence: T*, default: T ) -> T
Returns the last element from the sequence, or the default
argument if the sequence is empty.
Signature: lastOrNull<T>(self sequence: T*, default: T ) -> T?
Returns the last element from the sequence, or null if the sequence is empty.
Signature: range(start: number, count: number) -> number*
Returns a sequence of count
integers beginning with start
.
Signature: take<T>(self sequence: T*, count: number ) -> T*
Returns the first N elements of the sequence.
Signature: skip<T>(self sequence: T*, count: number ) -> T*
Returns a sequence where the first N elements are skipped.
Signature: eval<T>(self sequence: T*) -> T*
Signature: flatten<T>(self sequence: T**) -> T*
Flattens a sequence-of-sequences into a single sequence.
Signature: empty<T>(self sequence: T*) -> T*
Returns an empty sequence with the same type as the given argument. This function only exists for reasons of Flow Classic compatiblity.
Signature: hash(value: any) -> number
Returns a numeric hash of the value.
Signature: identity<T>(x: T) -> T
Returns the x
argument. If the type argument is explicitly written out, the function can be used to "upcast" values to the primitive type.
Signature: sleep(minMilliseconds: number, maxMilliseconds: number) -> number
Pauses script execution for a randomly chosen number of milliseconds between minMilliseconds
and maxMilliseconds
.
Converts the input argument to a number if possible. If the input cannot be meaningfully converted to a number, the function raises a runtime error. To preempt such errors, you can use the function.
Returns the input argument in .
Converts the input argument from into regular text.
Returns a boolean value indicating whether if the given pattern can be match in the input text.
Returns a sequence of matches, if any, for the pattern in the input text.
Replaces the matches of the given pattern with the replacement argument in the input text. If nothing in the input matches the pattern, the original input will be returned.
Creates a non-empty UUID as described in .
Valid pattern
argument for numbers are the same as standard format specifiers provided by to format numbers for decimal values.
Valid pattern
argument for numbers are the same as standard format specifiers provided by to format dates.
The locale
argument corresponds to a langue code as described in . If the locale argument is the empty text, the formatLocale function works the same as the format function.
Valid pattern argument for numbers are the same as standard format specifiers provided by to format numbers.
Valid pattern argument for numbers are the same as standard format specifiers provided by to format dates.
Converts a binary value into its text representation.
See also the
See also the .
Materializes a lazy sequence. See also