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 / Select newest added it...
Power Apps
Unanswered

Select newest added item in Gallery (sql connector)

(0) ShareShare
ReportReport
Posted on by 21

Whenever I add an item via a form, my gallery will jump to the record I had selected before I saved my new form.

 

I want it to jump to the newest added item. But somehow I can't  get it to work with SQL.

 

I found a solution on this forum, which said to use this in the Default property of the Gallery: 

First(SortByColumns(QuotesDataSource, "ID",Descending))

But this doesn't work with a sql datasource. It says that "First" is not supported.

 

Is there any other way to do this with a sql datasource?

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    Have you tried Sort with first;

    SortByColumns(QuotesDataSource, "ID",Descending)

    Or

    Sort(QuotesDataSource, ID,Descending)

     

     

    You can also use Set( VarLastData, FormName.LastSubmit) on the Onsuccess of the form.

    Then in the Default of the Gallery put;

    VarLastData

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Pieter_NL Profile Picture
    21 on at

    I tried both, both don't work 😞 

     

    Your last solution should work, I dont understand. Maybe the galley default isn't triggered after adding a record?

  • eka24 Profile Picture
    20,923 on at

    Did you try the lastSubmit.

     

    Does the form Datasource same as the Gallery Datasourc

     

    Also is the ID the auto Autonumber column in the SQL

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Pieter_NL Profile Picture
    21 on at

    Yes I tried the LastSubmit.

     

    The datasources are the same and the ID is an autoincrement primary key in SQL.

     

    When I restart the whole application, it works the first time I enter the form. But when I add a record, it won't trigger the default property. Is this correct?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard