cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BCWdesign
Helper I
Helper I

Looping flow based on a list of variables

 

Here is my issue

I have successfully completed the flow which fills in a form based on 3 variables inputted 

I now want to loop this flow so than rather than entering a single variable I enter a list and it works it way through the list

However it never moves onto the 2nd row 

I have included a Next loop but this still doesn't have the desired affect 

I think I have just missed something basic ?

any ideas?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel_NaNoi
Responsive Resident
Responsive Resident

Yeah this won't work, you're just making 3 nested loops, and I'm guessing your variables are single values not a list, so each loop just loops through once, the reason it doesn't go to a 2nd row is because well, your loops just looks at the first value of FinalDate variable, and because its only one variable, it ends, the other two for loops don't do anything either because they've ended already as well, you're only running this once.

 

I recommend to instead do the following:

If each variable that is being inputted needs to be used in your automation from flows specifically then:

Don't bother with the for loop, just remove it entirely, the for loop (only one loop, no need for more) should be in flows, starting your PAD process every iteration (you iterate over how many rows are input, e.g. if two rows of ID, Involvement, Date, then 2 iterations, I'm not sure where your data is stored for this so this part can be tricky).

 

This is also obviously really slow but easy, however if you want to get around the speed issue then you'll need to get creative with compose actions in flows to create lists that can be input into PAD for quick processing. I'd do something like the following to speed it up:

- Use 3 compose actions, one for each variable that combines like items together (so all dates together for example) into a list.

- Send the new variables that are lists into PAD

- Use a loop with an index (not a for loop) to iterate over the amount of items there are to input, e.g.:

*Loop start here with value of index 0 *

Input Singledates[%Index%],

input ID[%Index%],

Input Involvement[%Index%]

Increase value of Index variable by 1

*Loop end here*

View solution in original post

4 REPLIES 4
Pavel_NaNoi
Responsive Resident
Responsive Resident

Need some screenshots of your code, hard to tell what you're doing wrong otherwise.

Capture3.pngCapture2.pngCapture1.PNG

Pavel_NaNoi
Responsive Resident
Responsive Resident

Yeah this won't work, you're just making 3 nested loops, and I'm guessing your variables are single values not a list, so each loop just loops through once, the reason it doesn't go to a 2nd row is because well, your loops just looks at the first value of FinalDate variable, and because its only one variable, it ends, the other two for loops don't do anything either because they've ended already as well, you're only running this once.

 

I recommend to instead do the following:

If each variable that is being inputted needs to be used in your automation from flows specifically then:

Don't bother with the for loop, just remove it entirely, the for loop (only one loop, no need for more) should be in flows, starting your PAD process every iteration (you iterate over how many rows are input, e.g. if two rows of ID, Involvement, Date, then 2 iterations, I'm not sure where your data is stored for this so this part can be tricky).

 

This is also obviously really slow but easy, however if you want to get around the speed issue then you'll need to get creative with compose actions in flows to create lists that can be input into PAD for quick processing. I'd do something like the following to speed it up:

- Use 3 compose actions, one for each variable that combines like items together (so all dates together for example) into a list.

- Send the new variables that are lists into PAD

- Use a loop with an index (not a for loop) to iterate over the amount of items there are to input, e.g.:

*Loop start here with value of index 0 *

Input Singledates[%Index%],

input ID[%Index%],

Input Involvement[%Index%]

Increase value of Index variable by 1

*Loop end here*

Thank you this is very helpful!

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Top Solution Authors
Top Kudoed Authors
Users online (4,694)