cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NWEASD
Helper III
Helper III

Do Loop exit before condition

Hello,

I have a do loop that is running while a date is less than or equal to an end date.  For some reason it thinks that 3/8 is greater than 3/19.  I am not sure why it is doing this.  Any insight would be greatly appreciated.

NWEASD_0-1614110191601.png

The format commands are the following 

 

formatDateTime(variables('IncrementedDate'), 'M/d/yyyy')
formatDateTime(variables('EndDate'), 'M/d/yyyy')

 

1 ACCEPTED SOLUTION

Accepted Solutions
NWEASD
Helper III
Helper III

I was able to get this working by using the ticks() expression.  I converted the 2 dates to ticks and compared the ticks and got the expected run time.

View solution in original post

5 REPLIES 5
v-yiwenxie-msft
Microsoft
Microsoft

Hi @NWEASD 

 

Do you mean that the ‘do-until’ loop has been skipped?

 

In your case, the do-until loop will do the actions in it until the first ‘formatDateTime()’ is greater than the second ‘formatDateTime()’.

 

If it’s skipped, then it’s maybe the variables you defined or some other problems causing this problem. Could you take a screenshot of your detailed flow and the running result?

 

If the problem still exists, please feel free to let me know.

 

Best Regards,
Community Support Team _ Kira Xie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

NWEASD
Helper III
Helper III

The loop is running but it does not run to the full extent that I believe it should be running.  Below are screenshots

NWEASD_0-1614185867514.pngNWEASD_1-1614185906662.pngNWEASD_2-1614185931297.png

Second run of the loop...

NWEASD_3-1614185978575.png

Since the incremented date is < the end date I would expect this to run again.

 

NWEASD
Helper III
Helper III

I was able to get this working by using the ticks() expression.  I converted the 2 dates to ticks and compared the ticks and got the expected run time.

View solution in original post

NWEASD
Helper III
Helper III

This has reared its ugly head again.  I am still comparing ticks and it should continue running but it is not.  Any thoughts would be greatly appreciated.

 

NWEASD_0-1614704059326.png

NWEASD_1-1614704076340.png

 

for closer reference - 

NWEASD_2-1614704095865.png

 

the do until is - 

NWEASD_3-1614704134760.png

 

Found my own mistake.  I wanted the first number to be greater than the second to stop.  Apparently just need more eyes

Helpful resources

Announcements
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 Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (54,821)