- 23 May 2023
-
DarkLight
-
PDF
pop (array)
- Updated on 23 May 2023
-
DarkLight
-
PDF
Pop (array) Task Purpose
The Pop (array) task is used to remove the last element of an array and then return the removed element. This task decreases the length of the array by 1. If the array is empty, then the output returns undefined.
The results of the Pop (array) task can be validated by employing the length (array) task before and after the Pop (array) task. The length (array) task is discussed separately in the Task References guide.
Potential Use Case
You are systematically processing the values in an array, and your array should always represent the unprocessed records. The pop (array) task will remove the last element from the array, keeping your array "clean".
Properties
Input and output properties are shown below.
Incoming | Type | Description |
---|---|---|
arr |
array (required) | The array from which the element is to be removed. |
Outgoing | Type | Description |
---|---|---|
poppedArray |
array | The array without the last element. |
Examples
In the IAP examples shown below:
-
The incoming property variable is required and the reference task (used to define the data source) selected from the dropdown menu is
job
. The reference variable isarr
. -
The array variables for Pop (array) are manually set prior to running the workflow.
-
The variable name provided in the workflow and incoming variables values are displayed in the Task History (accessed from Jobs in Operations Manager).
-
The outgoing variable will be the result of executing the Pop (array) task.