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 / Problem setting defaul...
Power Apps
Answered

Problem setting default item in gallery to most recently updated

(0) ShareShare
ReportReport
Posted on by 12

I'm adding and updating items in a gallery1 with a collection as a data source. I add/update them by selecting items from another gallery2 and want to have the most recently added/updated item highlighted and defaulted.

 

I use a context varible: lastItem as the Default property for the gallery1 I'm adding to and set it to the last item added to the collection by using the Last function. This works fine.

 

But I'm not able to set the Default property of the gallery1 when I update an item in the collection. I identify the item to update using the Lookup function on the collection and set lastItem context variable to that item. However, it does not appear to affect the Default property. Even though the updated values are reflected in the gallery1.

 

Head Scratcher for me since I'm very new to Powerapps - any ideas what migth be going on here?

Categories:
I have the same question (0)
  • Verified answer
    jatcube Profile Picture
    508 on at

    Try setting the gallery default to

    First(SortByColumns(DataSource, "Modified", Descending))
  • pinne65 Profile Picture
    12 on at

    Thanks @jatcube - this worked! Had to add a Modified column to my collection.

    I still don't understand why my Lookup solution didn't work though

  • jatcube Profile Picture
    508 on at

    @pinne65 don't know either. It should work with a lookup or ID instead of Modified in the above formula. so you can use a lookup for the default like if you know the ID

    LookUp(DataSource, ID = 10)

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard