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 Apps / collect or set variabl...
Power Apps
Answered

collect or set variable to show last item ID only

(0) ShareShare
ReportReport
Posted on by 377

Hi there

 

I have a sharepoint list of images and wish to show the last submitted ID in a collection or variable.

 

Currently I have a collection called ImageID showing the ID's 

ClearCollect(ImageID,'Images-test'.ID,Sort('Images-test',ID, SortOrder.Descending))

I only need the last ID submitted and do not want to receive any others.

Is there any easy way?

 

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @StuCundy 

    This code will retrieve the last record submitted to a datasource

     

    Set(varLastRecord, First(Sort(your_datasource_name, ID, Descending)))

     

    To obtain the ID of the LastRecord use this code

     

    varLastRecord.ID

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard