• DOCUMENTATION
  • WORKATO BLOG
  • PRODUCT BLOG
  • Return to Workato
  • Log in
  • ☰
  • Community/Discussions
Solution home Recipe 101 Recipe Basics

Recipe Basics: Understanding Action #3: Repeat actions - How to process lists

Modified on: Thu, Jul 27, 2017 at 2:33 PM

What is a repeat action?

A repeat action is used to process a list of items such as a list of invoice line items. To identify lists in the app data, look for this icon in the app data:. This indicates that that particular object is an array (list) of items. For example, when you run a search within a google sheets sheet, the results will be shown as an array named "Rows" with pills nested under it. With a repeat action, you will be able to use the data from every row in the array.

 


Why can't I just use a regular action step?

As you can see from the app data above, the search results "Rows" is an array, with each line containing the columns of the fields within the sheet it was searching in. If you use one of these pills from this output directly, without a repeat step for mapping, the end product will only show data from the first line of the list no matter how many times you use the pill. line of the list no matter how many times you use the pill. 


How do I use a repeat action?

When you create a repeat action, you will see a nested step created. A nested step indicates that the step will be repeated for each row in the array, while anything outside this nest will only be processed once per job. If there are 3 rows in the array, this means that the steps would be repeated 3 times. 


Once you create the repeat action, you will need to set up the "Configure repeat" step. Simply drag and drop the array pill into the "Input list" field. 

Next, you will need to configure the action you want to process in the repeat step. For this example, we'll simply use a "Post message to slack" to show how each row is processed. When mapping your data under your repeat action loop, you will need to use the pills from the "Foreach" step output shown in the screenshot below under step 2. You will notice that the pills in this output will match those that were under the array which was given in the repeat action. 


However, only the pills from the foreach step will get the data from each row of the array. What this means is that for the first run of the repeat loop, the pills will use data from the first row; for the second run, it will use the data from the second row, and so on. If you use the pills from the original step, in this case, step one (Search rows), you will only get the first row of the array no matter which run of the foreach loop you are in. To illustrate this, we'll look at the messages coming into slack.



  Above, we have the sample sheet and the 3 rows which was obtained from the search. On the left, we have proper usage of the pills from the Foreach output, with each message showing a different row from the array. On the right, we have the bad usage, where we are taking the pills from the original output, and only get the first row of the array. 









Next: Understanding Actions #6: Action with Error monitor

Did you find it helpful? Yes No

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

Related Articles

    Still can't find your solution?

    Visit our forums to search for answers, or post your own questions.

    Documentation
    Developer's Library
    Tutorials
    eBooks
    Product Hour
    Product Blog
    Workato Blog
    Product updates
    Customer Stories
    © Workato 2020   Privacy   Terms   +1 (844) 469-6752
    • Documentation
    • Workato Blog
    • Product Blog
    • Solutions
    • Forums
    • Tickets
    • Log in
    • Return to Workato
    Article views count