cancel
Showing results for
Search instead for
Did you mean:
Regular Visitor

## do until 500 iterations faster than a blink

Hi all,

I'm trying to make a Power Automate flow in which a "do until" loop has to find a number and has to look for over 500 numbers.

I am aware that changing the limits it can do it, the problem is it takes AGES.

My question is: is there any way to make the flow go through all iterations in less than a minute or so?

The flow goes like this:

p.d.: a solution for this is to make several flows and in each look for a different range of numbers, p.e. one for numbers from 0 to 99, another one from 100 to 199. Although, I would like to know if there is a solution to do this in just one flow.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III

Hi @dpl

This is the approach I took to your problem, I made a video because it was a bit easier to explain:

https://youtu.be/URu_HWs8ozU

The large expression used in the filter action is:

``````@and(
or
(
startsWith(item(), '0'),
startsWith(item(), '1'),
startsWith(item(), '2'),
startsWith(item(), '3'),
startsWith(item(), '4'),
startsWith(item(), '5'),
startsWith(item(), '6'),
startsWith(item(), '7'),
startsWith(item(), '8'),
startsWith(item(), '9')
),
or(
endsWith(item(), '0'),
endsWith(item(), '1'),
endsWith(item(), '2'),
endsWith(item(), '3'),
endsWith(item(), '4'),
endsWith(item(), '5'),
endsWith(item(), '6'),
endsWith(item(), '7'),
endsWith(item(), '8'),
endsWith(item(), '9')
)
)``````

See how you get on.

Paul

7 REPLIES 7
Community Champion

Hi @dpl

I love a challenge but your problem to me is not clear.  Can you give us some sample data?  What are you trying to filter?

Your do until looks like your are staying in that loop until you change a variable from 1 to something else and you have a condition to check something in an email?  It's not clear.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien

P.S. take a look at my new blog here

Regular Visitor

Exactly, I have a condition in which I look either in the subject or the body of the email if it contains any string equal to 'RefCadena', which is actually a number ('Ref').

'Ref' is the variable that matters here, is the one that starts in 0 and grows over 500.

The loop ends when the condition is true and the email has either in the subject or in the body the mentioned string, then the variable 'Encontrado' (=found) is equal to 1 (when initialized it was 0).

This works "fine" if the 'do until' loops makes 60 iterations, the problem is: I want it to go over 500 or more numbers in less time.

Is there any way to solve this time problem?

I hope I made myself clear enough, if not I will keep in touch to clarify any doubts.

Cheers,

Daniela.

P.S. if it is of any help the variable initiation is the following:

Super User III

Hi @dpl

This is the approach I took to your problem, I made a video because it was a bit easier to explain:

https://youtu.be/URu_HWs8ozU

The large expression used in the filter action is:

``````@and(
or
(
startsWith(item(), '0'),
startsWith(item(), '1'),
startsWith(item(), '2'),
startsWith(item(), '3'),
startsWith(item(), '4'),
startsWith(item(), '5'),
startsWith(item(), '6'),
startsWith(item(), '7'),
startsWith(item(), '8'),
startsWith(item(), '9')
),
or(
endsWith(item(), '0'),
endsWith(item(), '1'),
endsWith(item(), '2'),
endsWith(item(), '3'),
endsWith(item(), '4'),
endsWith(item(), '5'),
endsWith(item(), '6'),
endsWith(item(), '7'),
endsWith(item(), '8'),
endsWith(item(), '9')
)
)``````

See how you get on.

Paul

Regular Visitor

Thank you very much Paul!! This is great

Thank you for taking the time 🙂

Regular Visitor

Hello again @Paulie78 ,

Thank you again for your useful reply! I implemented your flow and although it works fine, just what I asked for, I now have a different problem:

This is the email's body:

As you can see, after the number "2021900100" there are some enters ("\n").

My question is: How can I correct this?

I tried this expression:

split(outputs('Html_to_text')?['body'], '\n')

but it doesn't work...

Any suggestion?

Thank you.
Super User III

Just replace the \n with a space with an expression like this:

``replace(outputs('Html_to_text')?['body'], decodeUriComponent('%0A'), ' ')``
Regular Visitor

Great! Thank you very much!!

## Helpful resources

Announcements

#### Introducing Process Advisor

Check out the new Process Advisor community forum board!

#### Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

#### Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (22,494)