How to manipulate an array
These Calculated Field expressions change the contents of an array, such as the values of a multi-valued Field. Replace fieldAliasGoesHere with the alias of your Field.
Append a new element to an array
Uses push().
// Input: An array with value [1, 2, 3, 4, 5]
// Output: The same array with value [1, 2, 3, 4, 5, 6]
var array = $record['fieldAliasGoesHere'];
array.push(6);
array;
Remove a specific element from an array
Uses _.without(), which removes every element equal to the values you pass.
// Input: An array with value [1, 2, 3, 4, 5]
// Output: A new array with value [1, 2, 4, 5]
var array = $record['fieldAliasGoesHere'];
var filteredArray = _.without(array, 3);
filteredArray;
Sort an array in ascending order
Uses _.sortBy().
// Input: An array with value [4, 1, 5, 3, 2]
// Output: A new array with value [1, 2, 3, 4, 5]
var array = $record['fieldAliasGoesHere'];
var sortedArray = _.sortBy(array);
sortedArray;
Turn an array into a comma-delimited string
Uses join().
// Input: An array with value [1, 2, 3, 4, 5]
// Output: A new string with value "1,2,3,4,5"
var array = $record['fieldAliasGoesHere'];
var string = array.join(",");
string;