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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Last Item in Array
Power Automate
Unanswered

Get Last Item in Array

(0) ShareShare
ReportReport
Posted on by 50

I can succesfully retrieve a value from the first item in an array using this: 

body('TrackCont')?['Containers'][0]['eta_final_delivery']

Can someone tell me how to pull the same from the last item in the array? Array is of indeterminate length?

 

Thanks

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Chauc3r 

     

    You can use the last() expression to get the last value from the index of the array.

     

    Thanks

  • Chauc3r Profile Picture
    50 on at

    Hi @abm,

    Apologies, I'm rather out of my depth here.

    I tried rewriting that as 

    last('TrackCont')?['Containers']['eta_final_delivery']

    but it didn't like it!

     

    Also if you were able to point me at an idiot guide to flow syntax that be amazing!

  • haroldk Profile Picture
    on at

    Looks like you need a closing )  

    last('TrackCont')?['Containers']['eta_final_delivery'])

  • Chauc3r Profile Picture
    50 on at

    Hey @haroldbk_msft ,

    I tried multiple versions of that guy with no luck.....

     

    Computersaysno.png

     

    100% confident I'm doing something idiotic!

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Try the below in a compose

     

    last(body('TrackCont')?['Containers']))

     

    See the runtime history and see what it outputs

     

     

     

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Also see what this returns

     

    body('TrackCont')?last(['Containers'])

     

    Let me know how it goes. Once either of these expression works then its easy to extract the properties.

  • Chauc3r Profile Picture
    50 on at

    Sticking things into a compose and playing with them is probably the most useful tip I've ever had with Flow! Just makes things so much more visible!
    Thanks!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard