Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Avoiding apply to each loops with first() function

Like (0) ShareShare
ReportReport
Posted on 4 Nov 2022 08:54:25 by 76

Hi,

 

I am trying to filter out the weight of certain products using a oData connector, I want to use the 'quantity' of this weight as input for a variable. I can target the specific quantity i need but Power automate automatically makes an 'Apply to each' loop. I want to avoid this so i use the 'first()' function, right now the expression in my 'Compose' is: 

 
first(outputs('Get_Weight')?['body/value'])
 

This works, but i don't get the output i need, it gives ' "quantity" : 7.5' as output,   but i need '7.5' as output so i can use it as a double and calculate with it

45f792c0-2792-4780-909a-dfe525dc79d9.png

 

e8a2c764-9584-4d2f-aab6-3b4103f2beb5.png

 

Thanks

  • Verified answer
    v-bofeng-msft Profile Picture
    on 04 Nov 2022 at 09:17:06
    Re: Avoiding apply to each loops with first() function

    Hi @Kryptic ,

     

    Please try:

    first(outputs('Get_Weight')?['body/value'])['quantity']

     

    Best Regards,

    Bof

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started