Table of Contents | ||
---|---|---|
|
...
Description | Returns the last index at which a given element can be found in the array. This is similar to the JavaScript lastIndexOf. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: where $first contains [0, 2, 4, 6, 8] Result: 0 |
Anchor | ||||
---|---|---|---|---|
|
Description | The number of elements in an array. This is similar to the JavaScript length. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: A number. |
Anchor | ||||
---|---|---|---|---|
|
Description | Joins all elements of an array into a string. This is similar to the JavaScript join. | ||
---|---|---|---|
Syntax |
where optseparator is an optional string to separate the elements. If omitted, a comma is used. | ||
Examples | Expression: Result: the string SnapLogic Data Integration |
Anchor | ||||
---|---|---|---|---|
|
Description | Returns a new array with the values transformed by the given callback. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: where $myarray is an array Result: A new array where the elements have been multiplied by ten. |
Anchor | ||||
---|---|---|---|---|
|
Description | Removes the last element from an array and returns that element. This is similar to the JavaScript pop. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: The last element of the array. |
Anchor | ||||
---|---|---|---|---|
|
Description | Adds one or more elements to the end of an array and returns the new length of the array. This is similar to the JavaScript push. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: Mobile and Email will be added to that array and the new length of the array is returned. |
Anchor | ||||
---|---|---|---|---|
|
Description | Reduces an array to a single value using the given callback. For each element in the array, the callback is called with four arguments: the accumulated value (the result from previous calls or the initialValue), the value of the current element, the index of the current element, and the array itself. The exact behavior will change based on whether an initial value is provided. If no value is provided, the callback is called with the first element in the array as the accumulated value and the second element as the current value. If an initial value is provided, then the first call uses the initial value as the accumulated value and the first element as the current value. In general, it is safest to provide an initial value. This is similar to the JavaScript Array.reduce() method. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: where $myarray is an array Result: The sum of all of the elements in the array. |
Anchor | ||||
---|---|---|---|---|
|
Description | Like the reduce() method, except the elements are traversed right-to-left instead of left-to-right. This is similar to the JavaScript Array.reduceRight() method. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: where $myarray is an array Result: Builds a string of the elements in reverse order. |
Anchor | ||||
---|---|---|---|---|
|
Description | Transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array. This is similar to the JavaScript reverse. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: Returns the array in reverse order. |
Anchor | ||||
---|---|---|---|---|
|
Description | Removes the first element from an array and returns that element. This method changes the length of the array. This is similar to the JavaScript shift. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: The first element from an array. |
Anchor | ||||
---|---|---|---|---|
|
Description | Returns a shallow copy of an array containing copies of the original elements. This is similar to the JavaScript slice. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: where $Array contains [0, 2, 4, 6, 8] Result: [2,4] |
Anchor | ||||
---|---|---|---|---|
|
Description | Returns a sorted array. This is similar to the JavaScript sort. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: A sorted array. |
Anchor | ||||
---|---|---|---|---|
|
Description | Lets you remove and insert elements in an array and returns an array containing the elements removed This is similar to the JavaScript splice. | ||
---|---|---|---|
Syntax |
where:
| ||
Examples | For an array, $Contacts, defined as:
Expression: Result: Removes nothing, but inserts "Business" after "Last". Expression: Result: Removes "Zip", inserts "State", returns "Zip" in the output view. |
Anchor | ||||
---|---|---|---|---|
|
Description | Returns one string containing each array element separated by commas. This is similar to the JavaScript toString. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: Returns a string containing a comma-separated list of the array elements. |
Anchor | ||||
---|---|---|---|---|
|
Description | Adds the specified elements to the beginning of an array and returns the new length of the array. This is similar to the JavaScript unshift. | ||
---|---|---|---|
Syntax |
| ||
Examples | Expression: Result: Adds "Title" to the beginning of the array and returns the new array length. |
...