How to reach a specific iterator instance outside of loop?

0
Greetings,   My question is rather simple and straightforward. I’m looping over a list of items and when the item that is the current iteration instance fulfills a requirement I break the loop. What I desire is to use this specific object after the loop.  I’ve tried Retrieving an object with the same type and ID as the iterator right before breaking the loop and to my surprise, I’ve realized that this retrieved object cannot be reached after the loop.   Several other solutions come to my mind, for example creating a list before loop, putting the iterator inside it, and then use head operation but this feels like too complicated-of-a solution for such a simple problem.   Is there any simple and efficient methods that come to your mind?   Thank you for your help.
asked
1 answers
2

Ihsan,

I have solved this problem in 2 different ways:

  • create a list before the loop, populate the list with the current iterator and then using list operation head after the loop.  This does seem like a a lot of work, but in reality is only 3 additional actions in the microflow
  • create my own loop using Descision and Merge actions without using the built in Loop action.  For instance, if I have a list, I can
    • use Head to get the first object in the list
    • evaluate that object and, if it meets my conditions, follow a path that takes me out of the loop, where I will have access to the identified object
    • if the object does not meet my conditions, I can remove it from the list and go back to a Merge action before the Head action, get the next Head and continue on

Hope that helps,

Mike

answered