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 / Set Variable Assigned ...
Power Automate
Answered

Set Variable Assigned in Loop - Iterating Over Filtered Array & Outputting Identical Values

(0) ShareShare
ReportReport
Posted on by 5

Hello,

 

I am trying to create a workflow that will work in tandem with a Planner schedule I have created.

 

Planner Schedule in SharepointPlanner Schedule in Sharepoint

 

The goal is to send an e-mail twice a day that contains an HTML table with each job's Title, Due Date, and Production Phase (Bucket Name). I have the entire flow set up & working except for pulling the bucket names into the HTML table.

 

Whole FlowWhole Flow

 

I currently have a Filter Array looping through and comparing the Bucket ID of the task to the Bucket IDs from List Buckets in order to access the Bucket Name. After this I am attempting to Set Variable to the Bucket Name directly from the Filter Array loop. At this point in the flow the variables are outputting correctly for each Job ID.

 

Screenshot 2024-05-16 151547.png

Screenshot 2024-05-16 151834.pngScreenshot 2024-05-16 151903.png

 

My issue is that the Select action my table is based on is receiving identical values for each job because the variable is being assigned inside a loop that iterates over the filtered array. How can I arrange my actions to have the correct bucket names output for each job?

 

Screenshot 2024-05-16 153254.png

Screenshot 2024-05-16 153038.png

 

 

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

    Hi @CGood1 ,

    Please check this test:

    My Planner:

    vyetonggumsft_6-1715914428209.png

    The Result:

    vyetonggumsft_7-1715914453452.png

    My Flow Parameters Configuration:

    vyetonggumsft_2-1715913877710.png

    vyetonggumsft_3-1715914246189.png

    length(body('Filter_array'))
    
    {
     "Title": @{items('Apply_to_each')?['title']},
     "Due Date":@{formatDateTime(items('Apply_to_each')?['dueDateTime'],'MM/dd/yyyy')} ,
     "Production Pharse": @{items('Apply_to_each_2')?['name']}
    }

    Note that the html table is created outside the Apply to each and Apply to each2 loops.

    vyetonggumsft_4-1715914320188.png

    Best Regards,

    Sunshine Gu

  • CGood1 Profile Picture
    5 on at

    Thank you!!! I followed your example and it worked perfectly. 

    Maybe you could help me with one last thing... If I wanted to sort the table by Due Date where should I put that action in my flow?

  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @CGood1 ï¼Œ

    You can start a new post and I can help you solve this problem.

     

    Best Regards,

    Sunshine Gu

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 476

#2
Haque Profile Picture

Haque 424

#3
David_MA Profile Picture

David_MA 350 Super User 2026 Season 1

Last 30 days Overall leaderboard