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
filter
Returns an array of all elements that satisfy a condition. Access each element of the array with the $item variable.
The function to determine if the element should be included in the result
Returns
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
first
Returns the first element of an array
The array to get the first element from
Returns
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
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 function to apply to each element
Returns
slice
Extracts a portion of an array
The starting position (zero-based index)
The number of elements to extract
Returns
split
Splits a string into an array of strings given a separator
The separator to use for splitting
Returns
Comparison Operations
equals
Compares two values
The first value to compare
The second value to compare
Returns
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
isNull
Returns whether a value is NULL
The value to check for NULL
Returns
Logic Operations
and
Returns true if all values are true
The first value to compare
The second value to compare
Returns
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
Math Operations
divide
Divides two numbers (i.e. $numerator / $denominator
)
The numerator for the division
The denominator for the division
Returns
exponent
Calculates the exponentiation of a number by another number (base^exponent)
Returns
multiply
Multiplies two numbers
The first number to multiply
The second number to multiply
Returns
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
object
Handles an object composition by resolving its properties
The properties of the object to resolve
Returns
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
length
Returns the number of characters in a string
The string to measure length of
Returns
padLeft
Pads a string to the left
The length to pad to. If the length is negative, no padding takes place.
The character to pad with
Returns
padRight
Pads a string to the right
The length to pad to. If the length is negative, no padding takes place.
The character to pad with
Returns
replace
Replaces a value in a string
The substring to search for
The substring to replace with
Should the search be case sensitive?
Returns
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
substring
Extracts a substring from a string
The string to extract from
Returns
toLower
Converts a string to lowercase
The string to convert to lowercase
Returns
toUpper
Converts a string to uppercase
The string to convert to uppercase
Returns
trim
Trims whitespace from the beginning and end of a string
Returns
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
toNumber
Converts a value to a number. NULL is converted to 0
The value to convert to a number
Returns
toString
Converts a value to a string. NULL is converted to an empty string
The value to convert to a string
Returns