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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Looping through arrays
Power Automate
Unanswered

Looping through arrays

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm busy playing with the Planner connector and running into nested loop issues.

Ultimately I want to get my data into PowerBI, so I'm just using Excel as a stop-gap to collect the data (using insert rows) before I pull it into PowerBI.

 

I get a list of Plans and can write this easily enough to excel.

For each Plan, I get a list of buckets - but here it breaks down.  I can write the buckets of a specific plan if I input the ID, but if I want to iterate through a list of Plan ID's, I'm stuck.

 

I still need to get a list of tasks per bucket, and a list of task details per task, but I can't go any further than Plans because I can't nest loops.  I don't mind creating a fixed flow for each plan, but creating fixed flows for each bucket of each plan is a little tedious.

 

So - I know I can't nest loops, but I'm not sure how else to do this.  If I try and loop through a collection outside of the initial "Apply to Each" I get this error;

 

The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach.

 

Okay - so how do I loop over a collection and apply actions to each item?

I'd also like to avoid inserting duplicates into my excel every time I run the flow - but this also seems to require some level of nested loops - taking a list of the source and iterating through it to see if each row exists in a destination list....which also needs to be iterated through to test for each source line...Man Frustrated

 

Any advice or direction would be greatly appreciated!

 

Kind regards,

 

Russel

 

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi Russel,

     

    My understanding about your main requirement is that you need to get a list of tasks per bucket, and a list of task details per task. If this is correct, I think it could be done something like below:

    Capture.PNG

     

    Did I misunderstand anything? Would you please take a screenshot of your flow?

     

    Regards,

    Mona

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-monli-msft

     

    Yes, I think the issue was my expectation that tasks were a child of buckets and buckets a child of plans.

    I ran the flow using Sharepoint as the source and triggered subsequent child lookups on each new entry at the parent level using multiple flows.

     

    After I got the data into PoweBI it became evident that tasks are direct children of plans and have a bucketid reference, so they're linked, but not as children. I then amended my flow as follows;

     

    Flow 1 triggered by button

    Get plans and export them to a sharepoint "plan" list

    Get Tasks and Buckets (parallel flow) from the Plan and export them to a "Task" list and a "bucket" list

     

    Flow 2 triggered by new items in "Tasks" list

    Get tasks details and export them to a "task details" list

     

     

    So I have a workaround in SharePoint for now - The nested loop issue I started with would be evident if you had to add the listing of plans to your flow at the top in order to get the planID first, then list the tasks per planID and then the details per taskID all in the same flow...does that make sense?

     

    Kind regards,

    Russel

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard