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".
Input and output properties are shown below.
||array (required)||The array from which the element is to be removed.|
||array||The array without the last element.|
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 is
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 Job Manager).
The outgoing variable will be the result of executing the Pop (array) task.
- For general information on how to use tasks in Automation Builder, refer to the Tasks section in the Automation Studio documentation.