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 ComposerValue Composer

Value Composer in the Data Feed merge step

Array Operations

count

Returns the number of elements in an array
array
array
The array to count elements in
Returns
[output]
number
number

filter

Returns an array of all elements that satisfy a condition. Access each element of the array with the $item variable.
array
array
The array to filter
filterFunction
boolean
The function to determine if the element should be included in the result
Returns
[output]
array<T>
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.
array
array
The array to find the first element of
filterFunction
boolean
The function to determine if the element should be returned
Returns
[output]
T
T

first

Returns the first element of an array
array
array
The array to get the first element from
Returns
[output]
T
T

join

Joins an array of strings into a single string
array
array
The array of strings to join
separator
string
An optional separator to insert between the strings
Returns
[output]
string
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.
array
array
The array to map over
mapFunction
T
The function to apply to each element
Returns
[output]
array
array

slice

Extracts a portion of an array
array
array
The array to slice
start
number
The starting position (zero-based index)
length
number
The number of elements to extract
Returns
[output]
array
array

split

Splits a string into an array of strings given a separator
value
string
The string to split
separator
string
The separator to use for splitting
Returns
[output]
array
array

Comparison Operations

equals

Compares two values
value
T
The first value to compare
compare
T
The second value to compare
Returns
[output]
boolean
boolean

greaterThan

Compares two values and returns true if the first is greater than the second
value
number
The first value to compare
compare
number
The second value to compare against
Returns
[output]
boolean
boolean

isNull

Returns whether a value is NULL
value
T
The value to check for NULL
Returns
[output]
boolean
boolean

Logic Operations

and

Returns true if all values are true
value1
boolean
The first value to compare
value2
boolean
The second value to compare
Returns
[output]
boolean
boolean

if

Splits the execution flow based on a condition
condition
boolean
The condition to evaluate
then
T
The value to return if the condition is true
else
T
The value to return if the condition is false
Returns
[output]
T
T

Math Operations

divide

Divides two numbers (i.e. $numerator / $denominator)
numerator
number
The numerator for the division
denominator
number
The denominator for the division
Returns
[output]
number
number

exponent

Calculates the exponentiation of a number by another number (base^exponent)
base
number
The base number
exponent
number
The exponent number
Returns
[output]
number
number

multiply

Multiplies two numbers
value1
number
The first number to multiply
value2
number
The second number to multiply
Returns
[output]
number
number

Object Operations

get

Accesses a value of an object field with the given key
key
string
The key of the field to access
object
object
The object containing the field
Returns
[output]
T
T

object

Handles an object composition by resolving its properties
properties
object
The properties of the object to resolve
Returns
[output]
object
object

Text Operations

concat

Concatenates two strings
value1
string
The first string to concatenate
value2
string
The second string to concatenate
separator
string
An optional separator to insert between the concatenated strings
Returns
[output]
string
string

length

Returns the number of characters in a string
value
string
The string to measure length of
Returns
[output]
number
number

padLeft

Pads a string to the left
value
string
The original string
length
number
The length to pad to. If the length is negative, no padding takes place.
char
string
The character to pad with
Returns
[output]
string
string

padRight

Pads a string to the right
value
string
The original string
length
number
The length to pad to. If the length is negative, no padding takes place.
char
string
The character to pad with
Returns
[output]
string
string

replace

Replaces a value in a string
value
string
The original string
searchValue
string
The substring to search for
replaceValue
string
The substring to replace with
caseSensitive
boolean
Should the search be case sensitive?
Returns
[output]
string
string

slugify

Converts a string to a slug with no spaces or special characters
value
string
The string to convert to a slug
separator
string
The separator to use in the slug. It will be used to replace spaces and special characters.
Returns
[output]
string
string

substring

Extracts a substring from a string
value
string
The string to extract from
start
number
The starting position
length
number
Length of the substring
Returns
[output]
string
string

toLower

Converts a string to lowercase
value
string
The string to convert to lowercase
Returns
[output]
string
string

toUpper

Converts a string to uppercase
value
string
The string to convert to uppercase
Returns
[output]
string
string

trim

Trims whitespace from the beginning and end of a string
value
string
The string to trim
Returns
[output]
string
string

Transform Operations

toBoolean

Converts a value to a boolean
value
T
The value to convert to a boolean, e.g. “false”, “0”, and [] will all be converted to false
Returns
[output]
boolean
boolean

toNumber

Converts a value to a number. NULL is converted to 0
value
T
The value to convert to a number
Returns
[output]
number
number

toString

Converts a value to a string. NULL is converted to an empty string
value
T
The value to convert to a string
Returns
[output]
string
string