arrayRemoveAt - Removes element from array at given position
arrayRemoveAt
will return an array with the element at the given position removed.
Syntax
Like many functions in DataPrime, arrayRemoveAt
supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
Name | Type | Required | Description |
---|---|---|---|
array | array of type T | true | T must be either string , bool , number , interval , timestamp , regexp or enum |
position | number | true | The position at which to remove the element from the array. This value is 0 indexed |
Example - Removing a job from the middle of a queue
Consider the following document:
Removing an item from a given point in an array is as simple as:
This results in the following document:
Try it yourself
Open up your explore screen and enter the following command:
create values from ['Job 1', 'Job 2', 'Job 3', 'Job 4']
| create updated_values from values.arrayRemoveAt(2)
Theme
Light