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

push (array)

  • Dark
    Light
  • PDF

Article summary

push (array) Task Purpose

The push (array) task is used to add an element to the end of an array. It dynamically appends the array upon which it is invoked and returns the new array.

Potential Use Case

For an upcoming network fiber roll out, you need to sort through multiple contact records to collect the email addresses of customers who live within a specific area code so that you can notify them of the availability of enhanced services. As these customers are found in the database, use the push (array) task to add their email addresses to an array through which a downstream email task can then loop through for sending notifications.

Properties

Input and output properties are shown below.

Incoming Type Description
arr Array Required. The target array to receive the pushed element.
elementN Any Required. The element to push.


Outgoing Type Description
pushedArray Array The array with the pushed element.

Example 1

In the IAP examples shown below:

  • The reference tasks (used to define the data source) selected for each incoming variable is job.

    pushArray

  • The reference variable set for each incoming variable is arr and elementN, respectively. As an option, you can toggle the Run Window slider to set the push (array) task to run on a schedule.

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

    pushArray

    Note:

    If the array is empty, an error will be returned in the output.

    pushArray

  • Once you run the workflow, the variable names and incoming variables that were set are displayed under the Incoming tab in Task History, which is accessed from Jobs (Operations Manager).

    pushArray

  • The Outgoing tab displays the result of executing the push (array) task. Notice that "Device 3" was added to the end of the array.

    pushArray

Example 2

In this IAP example, a new array is created within our workflow, and the value of elementN is pushed into that new array.

  • The arr value is statically set as "[]", a pair of square braces.

  • The elementN value is statically set as the single string "Lemon".

  • The outgoing pushedArray variable will contain an array populated with one item ["Lemon"].

    pushArray

Example 3

Like the example above, a new array is created within our workflow. It is instantly populated with a 'space' value and then the value of elementN is pushed immediately into it.

  • The arr value is statically set as [" "], a pair of square braces with the string representation of a space.

  • The elementN value is statically set as the single string "Lemon".

  • The outgoing pushedArray variable will contain an array populated with two items [" ","Lemon"].

    pushArray


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.