Value Composer
Frontstack’s Value Composer is a powerful tool for transforming data. It allows you to chain together operations to create complex transformations. Below is an overview of the available operations:
Value Composer in the Data Feed merge step
Array Operations
count
Returns the number of elements in an array
The array to count elements in
Returns
number
filter
Returns an array of all elements that satisfy a condition. Access each element of the array with the $item variable.
The array to filter
The function to determine if the element should be included in the result
Returns
array<T>
findFirst
Finds and returns the first element of an array that satisfies a condition. Access each element of the array with the $item variable.
The array to find the first element of
The function to determine if the element should be returned
Returns
T
first
Returns the first element of an array
The array to get the first element from
Returns
T
join
Joins an array of strings into a single string
The array of strings to join
An optional separator to insert between the strings
Returns
string
map
Applies a function to each element of an array and returns the resulting array. Access each element of the array with the $item variable.
The array to map over
The function to apply to each element
Returns
array
slice
Extracts a portion of an array
The array to slice
The starting position (zero-based index)
The number of elements to extract
Returns
array
split
Splits a string into an array of strings given a separator
The string to split
The separator to use for splitting
Returns
array
Comparison Operations
equals
Compares two values
The first value to compare
The second value to compare
Returns
boolean
greaterThan
Compares two values and returns true if the first is greater than the second
The first value to compare
The second value to compare against
Returns
boolean
isNull
Returns whether a value is NULL
The value to check for NULL
Returns
boolean
Logic Operations
and
Returns true if all values are true
The first value to compare
The second value to compare
Returns
boolean
if
Splits the execution flow based on a condition
The condition to evaluate
The value to return if the condition is true
The value to return if the condition is false
Returns
T
Math Operations
divide
Divides two numbers (i.e. $numerator / $denominator
)
The numerator for the division
The denominator for the division
Returns
number
exponent
Calculates the exponentiation of a number by another number (base^exponent)
The base number
The exponent number
Returns
number
multiply
Multiplies two numbers
The first number to multiply
The second number to multiply
Returns
number
Object Operations
get
Accesses a value of an object field with the given key
The key of the field to access
The object containing the field
Returns
T
object
Handles an object composition by resolving its properties
The properties of the object to resolve
Returns
object
Text Operations
concat
Concatenates two strings
The first string to concatenate
The second string to concatenate
An optional separator to insert between the concatenated strings
Returns
string
length
Returns the number of characters in a string
The string to measure length of
Returns
number
padLeft
Pads a string to the left
The original string
The length to pad to. If the length is negative, no padding takes place.
The character to pad with
Returns
string
padRight
Pads a string to the right
The original string
The length to pad to. If the length is negative, no padding takes place.
The character to pad with
Returns
string
replace
Replaces a value in a string
The original string
The substring to search for
The substring to replace with
Should the search be case sensitive?
Returns
string
slugify
Converts a string to a slug with no spaces or special characters
The string to convert to a slug
The separator to use in the slug. It will be used to replace spaces and special characters.
Returns
string
substring
Extracts a substring from a string
The string to extract from
The starting position
Length of the substring
Returns
string
toLower
Converts a string to lowercase
The string to convert to lowercase
Returns
string
toUpper
Converts a string to uppercase
The string to convert to uppercase
Returns
string
trim
Trims whitespace from the beginning and end of a string
The string to trim
Returns
string
Transform Operations
toBoolean
Converts a value to a boolean
The value to convert to a boolean, e.g. “false”, “0”, and [] will all be converted to false
Returns
boolean
toNumber
Converts a value to a number. NULL is converted to 0
The value to convert to a number
Returns
number
toString
Converts a value to a string. NULL is converted to an empty string
The value to convert to a string
Returns
string