cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WillPage
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
WillPage
Impactful Individual
Impactful Individual

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
WillPage
Impactful Individual
Impactful Individual

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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

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

MBAS on Demand

Microsoft Business Applications Summit sessions

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

Users online (75,437)