[IMP] Loop question

Hello everyone, I am new to ActivePieces, but I have an important question,
I am currently using ActivePieces and also ODIN, which uses ActivePieces from behind, but I have a question.
Let me put you in situation:
I have a workflow in which when a new row is entered in Google Sheets (a text), it develops a series of validation steps and ends up analyzing by means of a Google Sheets formula : LENB(XXXXX) to count the characters of the previously entered text.
Based on this Google Sheets formula, a Branch is performed to determine TRUE (if the LENB result is between 50-70) or FALSE (if the LENB result is NOT between 50-70).
In the affirmative case, it should just run UPDATE from Google Sheets and finish.
The problem is in the negative case, you must generate through ODIN (it is the same if you use ChatGPT or OpenAI, it is the same case) a new text, to later re-analyze it with the LENB formula.
And again we go back to the Branch with the same TRUE and FALSE.
I was thinking of using a LOOP since the result we are looking for is always TRUE, then theoretically if the text generated by IA does not meet the requirements of LENB, should re-generate another text until it meets the requirements LENB.
The problem is that I don’t know how to tell the LOOP when to stop, that is to say, how can I explain to the LOOP that it must stop when once generated the new AI text the result of the BRANCH is TRUE, I don’t know if I explain correctly.
If someone can help me, I would appreciate it very much.
As I say ODIN is 100% based on ActivePieces, so for the demonstration I could also realize the workflow in ActivePieces.
I leave some images to exemplify the workflow.

Thank you very much.

Anyone? Please help
Im stuck in this workflow problem-

Thanks

Hi there @Javier_Martinez and welcome to our community :star:

just to get your problem clearly, you have a condition within your loop in which you want to stop the flow, right?
If so just add your branch and inside the true branch add an http step and use the return response action, it will end your flow.

1 Like

Sorry @Abdul but I never use that and I dont know how to make it work

@Abdul also I send this screenshot
Is the position right?

just put this inside the response input:
{}

The loop is not working, please help

Hi there @Javier_Martinez, what is the problem with the loop? please elaborate more so we can help :smiley:

I sent you a mail to: support@activepieces.com because I created a video to explain it, please help me in the mail.

Thanks.

Hi @Javier_Martinez,

It looks like you’re trying to do something similar to repeating a process until condition is met. One way to do this is by moving the part you want to repeat to another flow with webhook trigger.

Within this flow, towards the end, create a branch to determine whether to repeat the flow. If the decision is to repeat, you can trigger the flow using an HTTP trigger, as it has a webhook URL.

Another way is to create a loop that repeats a certain number of times, like 20. Each time it repeats, check if the condition you want is met. If it is, the process won’t continue. If not, it will repeat again. This method will repeat up to 20 times at most, but if the condition is met, the inside steps will be skipped

Please also take a look at:

For the second way “Another way is to create a loop that repeats a certain number of times, like 20. Each time it repeats, check if the condition you want is met. If it is, the process won’t continue. If not, it will repeat again. This method will repeat up to 20 times at most, but if the condition is met, the inside steps will be skipped”

Can you share a screenshot of What I need to do with the current loop i have?

Thanks.

Hi @Javier_Martinez

Take look at this template https://cloud.activepieces.com/templates/Z75lzzxEXFPv4rJOlJiZx

This repeats up to 20 times and stop until it generate number smaller than 10

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.