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 / Loop through an array ...
Power Automate
Answered

Loop through an array by a value in another array to create a different array

(0) ShareShare
ReportReport
Posted on by 876 Super User 2026 Season 1
Hello -
 
I've tried different 'apply to each' scenarios without luck for the following.
 
I want to loop through array 1 by zone using value zone number in array 2 and create array 3.
 
Array 1
[
{
"Zone": "1",
"LookUpStr": "25"
},
{
"Zone": "2",
"LookUpStr": "35"
},
{
"Zone": "3",
"LookUpStr": "80"
},
{
"Zone": "4",
"LookUpStr": "45"
},
{
"Zone": "5",
"LookUpStr": "157"
}
]
 
Array 2
[
{
"Zone Number": 2
},
{
"Zone Number": 3
},
{
"Zone Number": 4
}
]
 
Array 3 created by flow
[
{
"LookUpStr": "35",
"LookUpStr": "80",
"LookUpStr": "45"
}
]
 
Appreciate any suggestion.
Thanks!
Categories:
I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at
     
    Try this approach without using loop :)
     
    1. use 2 initialize variables to initialize array 1 and array 2 as shown below
     
     
     
    2. use compose action to format the Array 2 as shown below
     
     
    3. Use filter array to get required values
    Expression: 
    xpath(xml(outputs('Format_Array2')),concat('//Zone_x0020_Number/text()=','''',item()?['Zone'],''''))
     
    4. use select action to select LookUpStr property from output of filter array
     
    see the output of select action 
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

  • Cgangweg01 Profile Picture
    876 Super User 2026 Season 1 on at
    Thank you! @Nived_Nambiar 
     
    That worked! I was even able to use the output in an apply to each to make an API call per LookUpStr number. Awesome! Now I need to figure out how to compile each API call result into a single array for further filtering.
     
    Also wondering ... could you explain what the xpath expression is actually doing?
     
    xpath(xml(outputs('Format_Array2')),concat('//Zone_x0020_Number/text()=','''',item()?['Zone'],''''))
     
    Thanks Again!

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

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 411

#2
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 291

Last 30 days Overall leaderboard