Help Desk

Submit a ticket My Tickets
Welcome
Login

Iterator

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. If you are new to lists, imagine asking the owner of a fruit stand what type of fruits are available. The response might say “we have apples, oranges, and bananas”. This is an example of a list and with 3 elements for each type of fruit. Let’s apply this concept to OneCloud whereby we want to run the command as many times as there are types of fruit. If we are using the example above, the command would execute 3 times for each value in the list. Here is an example of creating three separate directories for each fruit:

Step 1: Create a New Chain

  1. Select the Build on the side navigation.
  2. Select the DEV environment.
  3. Add a new Chain and name it "Iterator Example".
  4. Add a Command File Utilities -> Create Directory by dragging on to the pallet.
    (Hint: use the Find tool to search for "File Utilities" and then search for "Create Directory")
  5. Slide on the iterator option. 
  6. Type in the three elements for each fruit - "apples", "oranges", and "bananas".
    (Hint: Press <ENTER> after each fruit is added)
  7. In the Directory parameter, type in the value "/tmp/" and select the Command iterator temporary variable from the variable selector. 
  8. Save the command.

Step 2: Publish and Run the Iteration Chain

  1. Publish and run the chain.

Sourcing Lists from Output

In the example above, the list was fixed in the command, however, it is most common to source lists from a command output so they are dynamic such as a list of files.

What's Next?

> Return to Start

B
Brian is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.