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 / Get value from field f...
Power Automate
Answered

Get value from field from within a For Each loop

(0) ShareShare
ReportReport
Posted on by 301
Hello,
I want to get the first value from a field within a For each loop so I can use for a value in a json file.  I have tried so many things now and none work, I thought this would be really simple. 
I have tried using first() it tried to create a For Each loop within the existing loop which I don't want.
I have then created a variable to put the value into and moved that out of the generated for each loop but I still get an error.  I don't think really need to put it into a variable though.
 
I have mulitple json objects within a For Each loop they repeat the same values in some of the fields, I want to get the value of one of these fields.
Booking Ref.
 
This is the output from the Filter Array step, I want to get the Booking Ref value.
 
Categories:
I have the same question (0)
  • Suggested answer
    CFernandes Profile Picture
    8,504 Most Valuable Professional on at
    Hey, Why don't you try using PARSE JSON. I generated the schema using the JSON output of you Filter array
     
     
     
    Full Flow
     
     
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
     

    Does this answer your question?
     

     
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.
     
  • Rosie Profile Picture
    301 on at
    First I have to split the original json objects into different sales orders which is what I am doing in the For Each 3 loop.
    The Filter array then contains all the json objects for one sales order.
     
    Regards
    Rosie
  • Verified answer
    Rosie Profile Picture
    301 on at
    I finally got the right format to get to the value in the json from the 'Filter array' step
    first(body('Filter_array'))?['Booking Ref']
     
    I didn't need the set variable step.
    I had tried using Select which worked and was the catalyst for getting the structure of the expression correct.

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 785

#2
Valantis Profile Picture

Valantis 669

#3
Haque Profile Picture

Haque 563

Last 30 days Overall leaderboard