• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Enhancement Requests Core Product Features
B

Brad Eisenberg

started a topic over 6 years ago

Action Request: Repeat Action until a Set of Conditions Hold true (or false)

I'd like the ability to create a repeat action that continually checks for a set of conditions to be true before continuing on in the recipe. I imagine this could be designed where the repeat action executes on a clock timer with specified duration rather than an input list. Then there would have to be a new action similar to the stop action within a conditional action in the loop that allows the recipe to kick out of the loop rather than stopping the recipe all together. Or this could all be built into the configuration of the repeat action itself so it act almost like a second trigger function.


5 people like this idea
M

Miranda Lau

said over 5 years ago

I'm looking for a Do While loop action on Workato where the recipe continues looping through until a certain condition is met. This is a pretty common dev logic. Hope the team will consider building an action for Repeat by condition logic. 


Thank you!

Amanda Wong

said over 5 years ago

Hi Miranda, I believe I have shared a recipe logic that you can build to achieve this but would like to repeat it here.


Brad, this makes use of the append "<<" operator shared with you in a different discussion about variables.


--

 

While there isn't a prebuilt feature to do so on Workato, there is a workaround using a repeat action: Create a repeat action loop with a dummy list, and escape loop when condition is met


Instructions:


Step 1: Create a dummy list to be used for iteration (App: Lists by Workato, Action: Create list)

  • Define the size of list as the maximum number of iterations that should occur.


Step 2: Initialize an empty array using Logger to log a message in formula mode

  • image



Step 3: Create a Repeat action to iterate over the list created in Step 1

  • Note: All subsequent steps mentioned are nested under this action


Step 4: Create a Conditional action.

  • Think of a codeword that you want to use to tell the recipe that the condition to escape the loop is met (e.g. "Ready")
  • Then configure the Conditional action, mapping the "Message" pill output from step 2 into the "Data field" set up as shown below

    image


    Step 4: Conditional Action Set Up



Step 5: Create the recipe logic that you would like to implement with the following format.

  • If condition is not met, wait e.g. 5 minutes (so recipe will pick it up later after changes have been made in your app). 
  • Note: The Wait action (App: Scheduler) here is important so that the recipe waits before executing the next iteration.

  • If condition is met, append codeword defined earlier i.e. "Ready" to the empty array initialized i.e. "Message" data pill from Step 2 output
  • What this does is to map the word "Ready" back to step 2's message pill. This means that for the next iteration, the conditional action in Step 4 will evaluate to false i.e. message pill contains "Ready". This will cause the recipe to escape the loop created, and the recipe will move on to the actions after the For Each action, skipping the nested block of actions built within the loop.
 


Below is an example of how the repeat action may be configured






1 person likes this
V

Vinny Sosa

said almost 2 years ago

This is such a silly and wasteful way to do this. Even though the condition is met and Workato will not perform any function after the ready state the loop will continue until the end. what if the number of times was 10,000 or unknown? What if you don't know how much data there is? When is Workato going to work this out so that there is a proper loop until a condition is met. This is such a simple function and a HUGE miss for this platform.


6 people like this
M

Micheal Sihavong

said 12 months ago

Has a "break" repeat been added yet? This is a fundamental capability in any coding language and I would expect, fundamental in the low-code world

Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

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