cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Impactful Individual
Impactful Individual

Do Until not working properly - hits the 60 limit

I have a Flow that I'm trying to use to build an array of dates. I have a data source with a date column and an integer column for number of days (actually nights). It's for property bookings.

 

What I want to do is build an array of all the individual dates and then finally join it in a comma separated list.

 

I'm having some degree of success by using a for-each on the items in the data source and within that, a do-until as below.

 

Capture.PNG

 

Some explaination about what I'm doing here. Before the start of the for-each I initialise the variables: var_nights is integer and set to 0, var_dateArray is an array and var_tempDate is a string.

 

My theory is that var_nights is incremented by 1 on each pass of the do-until, until it equals the value of the Nights column in the current item.

 

Within the do-until, the first action is Append to Array Variable, and the formula is basically addDays(tempDate, 1). The second action increments the integer var_nights by 1 and then finally I add a day to var_tempDate by doing addDays(last(var_dateArray), 1).

 

I start var_date at 0 because I actually want one more date in var_dateArray than the number of nights (including the checkout date) so if the first night is 2020-01-01 and the Nights is 3, then var_dateArray should be 2020-01-01,2020-01-02,2020-01-03,2020-01-04.

 

This all seems to work OK except that it doesn't stop the do-until when var_nights is equal to items('Apply_to_each')?['Nights']. I can put an extra compose steps in the apply to each to show the value of it and it looks like it should work, but it just keeps going until it hits the default limit of 60 iterations of the do-until.

 

This example below shows the value of items('Apply_to_each')?['Nights'] in a Compose, and also the value of var_nights in the Increment variable step. They are both 14, but the flow carries on to 60. What's going on and how do I fix it?

 

Capture.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Impactful Individual
Impactful Individual

Re: Do Until not working properly - hits the 60 limit

Wow, solved it litterally 1 minute after posting this. Seems like the Nights column is being interpreted as a string, so I can just wrap the int() expression around it in the do-until.

View solution in original post

1 REPLY 1
Highlighted
Impactful Individual
Impactful Individual

Re: Do Until not working properly - hits the 60 limit

Wow, solved it litterally 1 minute after posting this. Seems like the Nights column is being interpreted as a string, so I can just wrap the int() expression around it in the do-until.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,252)