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?

Anonymous
Not applicable

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,699)