cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Need help in Do until

Let's assume that I have a table Row ID, Start year, End Year and Year. If User enter Row ID - 1, Start year - 2017, End Year - 2020

then my flow should add rows like in the picture. Any help here would be really great!

 

Datasource: SQL server.  Need to run this flow in Power Apps.

 

Capture.JPG

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous I realized I forgot to increment the variable in the sample I shared with you! Apologies. That would explain why you are getting 200+ rows. You need to increment the 'Year' variable inside the Do-Until loop.

 

The reason I started the 'Year' variable with  'Start Year'+1 is because I thought the input row from your example was already in the table. Is that true?

View solution in original post

7 REPLIES 7
melim
Power Automate
Power Automate

Hi Gopi,

 

Do-until loops are used to repeat a step until a condition is met. From your photo it looks like you are adding a row to the SQL table for each year that will pass between the start year and the end year, inclusive.

 

In this case, you can initialize a variable 'Year' with ('Start Year' + 1), and add a row until 'Year' equals the 'End Year'.  Here's my example. I declared 'Start Year' and 'End Year' as variables, but you'll use the dynamic content from the SQL inserted row trigger.

 

DoUntilExample.png

Anonymous
Not applicable

Please see the images. I have created flow like your example but it is adding only one line. Am I missing anything here?

 

'Initializevariable_Value' = Start Date (SOP SQL column name) + 1

 

'Insertrow_Year' = End Date (EOP SQL column name)

 

FlowFlowSQL OutputSQL Output

Hi @Anonymous

 

Drag and drop your 'Insert Row' action inside 'Do until'

 

Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


Anonymous
Not applicable

I am not sure why! It is running more 200+ rows and all the Year field as Start Date  +1. Smiley Sad

 

Is there any video tutorial to help me here?

Anonymous
Not applicable

If I use Start Date + 1 inside flow itself then it is throwing error.Capture.JPG

@Anonymous I realized I forgot to increment the variable in the sample I shared with you! Apologies. That would explain why you are getting 200+ rows. You need to increment the 'Year' variable inside the Do-Until loop.

 

The reason I started the 'Year' variable with  'Start Year'+1 is because I thought the input row from your example was already in the table. Is that true?

View solution in original post

Anonymous
Not applicable

It's working now! Thank you so much! Smiley Happy

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,006)