Skip to content

Function


Transform

Function is a widget flow node that allows you to execute predefined functions on your data.

Description

The Function node provides a way to perform data transformations, calculations, and other operations using built-in functions. This is useful for manipulating context values, formatting data, or performing calculations before passing data to subsequent nodes.

Configuration

The configuration consists of a list of functions to execute in sequence. Each function has a name and arguments.

Function Name

Function Name – the name of the function to execute. Available functions include:

NameDescriptionArguments
Math addition (+)Adds two numbers together2
Math subtraction (-)Subtracts second number from first2
Math multiplication (*)Multiplies two numbers together2
Math division (/)Divides first number by second2
Math modulo (%)Calculates remainder after division2
Math power (a^b)Raises first number to power of second2
Math square root (√a)Calculates square root of number1
Math absolute (|a|)Gets absolute value of number1
Math signGets sign of number (-1, 0, or 1)1
Math floorRounds number down to nearest integer1
Math ceilRounds number up to nearest integer1
Math roundRounds number to nearest integer1
String to lower caseConverts string to all lowercase1
String to upper caseConverts string to all uppercase1
String trimRemoves whitespace from start and end1
String lengthGets number of characters in string1
String replaceReplaces first occurrence of substring3 (input, find, replace)
String replace all occurrencesReplaces all occurrences of substring3 (input, find, replace)
String replace using regular expressionReplaces matches using regex pattern3 (input, regex, replace)
String encode to base64Encodes string to base64 format1
String decode from base64Decodes string from base64 format1
String encode to base64urlEncodes string to base64url format1
String decode from base64urlDecodes string from base64url format1
String encode to URLEncodes string for use in URLs1
String decode from URLDecodes URL-encoded string1
SubstringExtracts portion of string using indices3 (input, start, end)

Arguments

Arguments – the arguments to pass to the function. You can use context values as arguments, and the function will be applied to those values.

WARNING

For string operations, a missing context value is treated as an empty string (''). For mathematical operations, a missing or non-numeric value is treated as 0.

INFO

Functions are executed in the order they appear in the configuration. The output of one function cannot be used as input for the next function in the same node.

Limitations

NameValue
Max functions50
Max function argument input length1024
Max compiled argument lengthUnlimited
InputsExactly one
OutputsExactly one

Context values

Each function in a node generates a context value in the format return_fn_{n} (where n is sequential number of a function starting with 1), which contains the result of the function execution.