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 Apps / Why is my code not ret...
Power Apps
Answered

Why is my code not returning the last record?

(0) ShareShare
ReportReport
Posted on by 831 Moderator

I have a button on the first screen of my app that, when clicked, writes a new record to a dataverse table then navigates to the next screevn. On that screen I have a lbl that is supposed to show the last Generated Placement ID. This is the code I am using for the text property of that label. 

 

 

Last('Placement IDs -DEVS').'Generated Placement ID'

 

 

This used to work but now doesn't. It is stuck showing the same record which is Generated Placement ID 0005. Below is the table. As you can see the new records are successfully added but my code is not grabbing those. Any ideas?

 

futr_vision_0-1704839742310.png

 

Categories:
I have the same question (0)
  • Verified answer
    SpongYe Profile Picture
    5,616 Super User 2025 Season 2 on at

    Hi @futr_vision 

     

    Try this:

    First(
     Sort(
     'Placement IDs -DEVS', 
     'Generated Placement ID', 
     SortOrder.Descending
     )
    ).'Generated Placement ID'

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

  • futr_vision Profile Picture
    831 Moderator on at

    This works. A little more verbose than I expected but I can't complain.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard