web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Most efficient way to loop through an array on each trigger [Looking for improvement]

(0) ShareShare
ReportReport
Posted on by 46

Hi there, I created this flow (works fine) which loops through an external array (stored in Excel) to get the new value to be used in the flow.

 

It works like this

  1. Initialize index & value (from Excel)
    • Also convert string value to integer
  2. Increment index after operation
    • If end of array is reached, reset index

 

Looking at my flow below, I was wondering if there is a more simple and efficient way to achieve these steps?

 

KarelVGH_0-1716806390432.png

 

Flow in detail - The logic behind each step

 

So I init a raw string value (because value in Excel is retrieved as a string) and I need an integer for my index, so I convert it afterwards.

I also need a 'newindex' to store the old and new index for my reset-check later in the flow.

 

KarelVGH_1-1716806441173.png

 

I then retrieve the matching email for the current index, then I increment the index.

A check now follows to see if the end of the array has been reached, if so, its reset to 1.

 

KarelVGH_2-1716806688251.png

 

For you info, this is the Excel:

 

KarelVGH_3-1716806795419.png

 

 

 

Again, this works great, but I can't let go of the fact that this flow seems bloated, any thoughts? Cheers!

 

I have the same question (0)
  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on at
    Re: Most efficient way to loop through an array on each trigger [Looking for improvement]

    Hi @KarelVGH 

     

    Alternatively, you can use "Select" action to optimize the flow & transform the input array. I am not sure what you are trying to achieve here.

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • Karel (ACSW) Profile Picture
    46 on at
    Re: Most efficient way to loop through an array on each trigger [Looking for improvement]

    Hi there Manish,

     

    The trigger is when a new task comes in, I have a list of 3 people who can be assigned, and it simply loops through them for each new task so it's assigned evenly. Therefore I think the Select action is not an improvement, or is it?

  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on at
    Re: Most efficient way to loop through an array on each trigger [Looking for improvement]

    Hi @KarelVGH 

     

    Yes, you are right. In that case, Select will not solve the purpose. Select action would have improvised the flow execution if you are having a single task with multiple assignees. 

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • Karel (ACSW) Profile Picture
    46 on at
    Re: Most efficient way to loop through an array on each trigger [Looking for improvement]

    But I did learn something new & useful so thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 788 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 452 Moderator

#3
developerAJ Profile Picture

developerAJ 302

Last 30 days Overall leaderboard