The OneCloud iterator function is a powerful capability to leverage a static list or list output and set a temporary variable based upon the current value in a list.

New to lists? Imagine asking the owner of a fruit stand, "What type of fruits are available?" The response might be, “We have apples, oranges, and bananas”. This is an example of a list and with three (3) elements for each type of fruit.

Let’s apply this concept to OneCloud, whereby a user wants to run the command as many times as there are types of fruit. Following the example above, the command would execute three (3) times for each value in the list.

Here is an example of creating three (3) separate directories for each fruit:

Step 1: Create a New Chain

  • Select the Build from the left-side navigation.

  • Select the DEV Environment.

  • Add a new Chain and name it "Iterator Example".

  • Click Save.

  • Add a Command File Utilities ➡️ Make Directory by dragging on to the pallet.
    💡 Hint: Use the Find tool to search for "File Utilities" and then search for "Create Directory".

  • Slide on the Iterator option.

  • Type in the three elements for each fruit - "apples", "oranges", and "bananas".
    💡 Hint: Press <ENTER> after each fruit is added.

  • In the Directory parameter, type in the value "/tmp/"

  • In the variable sector, under Command Iterator, select the Command Iteration

  • Save the Command.

Step 2: Publish and Run the Iteration Chain

  • Near the upper-right corner, click "Publish" and then "Publish" again.

  • Click "Execute", then select the "Run Chain" button.

  • When the Command complete, double-click the icon and check the "LOGS".

📓 Sourcing Lists from Output

Note: In the example above, the list was fixed in the command. However, lists are most commonly sourced from command output, and, thus, are dynamic. Ex. A list of files.


📚 Additional topics covered in this article:

Command Output

Iteration Command



Did this answer your question?