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 Platform Community / Forums / Power Automate / Most efficient way to ...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 48

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!

 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 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
    48 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,091 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
    48 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard