pop (array)
  • 23 May 2023
  • Dark
    Light
  • PDF

pop (array)

  • Dark
    Light
  • PDF

Article summary

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 is arr.

    popArray-01

  • The array variables for Pop (array) are manually set prior to running the workflow.

    popArray-02

  • The variable name provided in the workflow and incoming variables values are displayed in the Task History (accessed from Jobs in Operations Manager).

    popArray-03

  • The outgoing variable will be the result of executing the Pop (array) task.

    popArray-04


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.