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

Terminate within Do Until not allowed. Understood. But what about this case...

I'm using a "Do Until" loop to parse an array and skip the first index each time it doesn't match a particular string. In a case when the string is never found the flow errors out and lists a 'failed' because the array length goes to zero and the loop cannot continue. That's OK, but it might happen 50% of the time in my case which is a lot of fails and has caused flags in Power Automate in the past.

 

Ideally I'd like to check if length(variables('myArray')) is less than 1 and then terminate with 'Success'.

Has anyone got a fabulous idea for a workaround for this? Bearing in mind that the flow in question is incredibly complex with 70 parallel branches formed from nested switch statements and cannot be split upstream from the branching steps.

 

Screen Shot 2021-03-22 at 6.56.28 pm.png

 

 

The error is:

"The workflow run action 'Terminate' has type 'Terminate' that is not allwed to be nested under an action of type 'until'.'."}}". Code: 0x80060467 InnerError" complete with typo from the Flow department at Microsoft!

2 ACCEPTED SOLUTIONS

Accepted Solutions
tom_riha
Super User
Super User

Hello @HydrogenUtility ,

I wouldn't call it a "fabulous idea for a workaround", but you could move the length(..) condition to the 'Do until' condition. If you switch to advanced mode it'll allow you to add multiple conditions, e.g.

@or(equals(variables('oneChar'), 'd'), less(length(variables('array')), 1))

image.png

Then you can add another 'Condition' after the 'Do until' to terminate the flow (if needed).



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

HydrogenUtility
Helper III
Helper III

This is a great solution and worth the tests, below, being

1) this = that before that < this

AND 

2) that < this before this = that :

@or(equals(variables('subjectArray')[0], variables('projectPhase’)), less(length(variables('subjectArray')), 1))

@or ( less(length(variables('subjectArray')), 1) , equals(variables('subjectArray')[0], variables('projectPhase’)))

Because although the code as entered doesn't throw an error, it is long enough that it overshoots the tiny edit window in the power automate GUI and editing in another editor is misleading when copy / pasting into that tiny window. So when I finally did get the syntax correct (style 1) the problem persisted in that the array was whittled down to empty and then the condition referenced index [0]. Therefore error.

The second attempt (style 2), amazingly solved the problem as the first condition in the 'or' logic was tested first saving the empty array from interrogation. Therefore no error.

@tom_rihaI'm happy to call it a fabulous workaround. Thank you.

 

View solution in original post

2 REPLIES 2
tom_riha
Super User
Super User

Hello @HydrogenUtility ,

I wouldn't call it a "fabulous idea for a workaround", but you could move the length(..) condition to the 'Do until' condition. If you switch to advanced mode it'll allow you to add multiple conditions, e.g.

@or(equals(variables('oneChar'), 'd'), less(length(variables('array')), 1))

image.png

Then you can add another 'Condition' after the 'Do until' to terminate the flow (if needed).



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

HydrogenUtility
Helper III
Helper III

This is a great solution and worth the tests, below, being

1) this = that before that < this

AND 

2) that < this before this = that :

@or(equals(variables('subjectArray')[0], variables('projectPhase’)), less(length(variables('subjectArray')), 1))

@or ( less(length(variables('subjectArray')), 1) , equals(variables('subjectArray')[0], variables('projectPhase’)))

Because although the code as entered doesn't throw an error, it is long enough that it overshoots the tiny edit window in the power automate GUI and editing in another editor is misleading when copy / pasting into that tiny window. So when I finally did get the syntax correct (style 1) the problem persisted in that the array was whittled down to empty and then the condition referenced index [0]. Therefore error.

The second attempt (style 2), amazingly solved the problem as the first condition in the 'or' logic was tested first saving the empty array from interrogation. Therefore no error.

@tom_rihaI'm happy to call it a fabulous workaround. Thank you.

 

View solution in original post

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.

Top Solution Authors
Users online (2,690)