cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Magoforrest
Helper I
Helper I

sort descending, Ascending in a gallery

Hi all,

I am sure that my question is dumb, but I am stuck......

I have an Excel table that I fill in with another app, now I am trying to visualize it from a gallery in order from the last insertion on the table... I tried Sort(datasource, Descending) but it doesn't work...any suggestions? THX in advance

9 REPLIES 9
Drrickryp
Super User
Super User

@Magoforrest 

Every table should have an ID number incremented sequentially as a new record is added. This allows you to sort it descending. It also allows relationships between tables based on their ID.

v-qiaqi-msft
Community Support
Community Support

Hi@Magoforrest,

Do you want to sort your records in your Excel table by the last updated time?

Could you please tell me that if there is a Date related column that could identify the time you update the record?

I think there is something misunderstood with the Sort() function.

Sort( Table, Formula [, SortOrder ] )

  • Table - Required. Table to sort.
  • Formula - Required. This formula is evaluated for each record of the table, and the results are used to sort the table. You can reference columns within the table.
  • SortOrder - Optional. Specify SortOrder.Descending to sort the table in descending order. SortOrder.Ascending is the default value.

The formula you provided Sort(datasource, Descending) is lack of the required part, Column name.

So if you want to sort the table by the time of update, you should created a column to store the created date time. Or if you do not need to edit the existing record, you could directly create a primary key like ID in the table. Then you could sort the Table by setting the Items property of the Gallery as below:

Sort(datasource,ID,Descending)

Hope it could help.

Regards,

Qi

 

Best Regards,
Qi

thx for the answer, it looks simple but i am  still having problems, since a posted i moved my app on a sharepoint list and i am trying this:

 

Sort(GRF.FINALRwyCcA,ID,Descending)

 

in wich my list is GFR my column is FINALRwyCca... i cant get it....ahhhhh

In my FINALRwyCca i have a number

And I am waiting for the result to appear on a label, not in a gallery label, I don't know if this info can help. thx

i got something working using a lookup:

LookUp(GRF.FINALRwyCcA,true,FINALRwyCcA.Value).... but i am getting the first element on my list... i need the last 😞

Hi@Magoforrest,

Could you please try the Filter()?

 

Last(Filter(GRF.FINALRwyCcA,true,FINALRwyCcA.Value))FINALRwyCcA.Value

 

In addition, if you just want to sort the FINALRwyCca , you could sort as below:

 

Sort(GRF,FINALRwyCcA,Descending)

Could you please tell me that if the FINALRwyCca is a LookUp column or a Number?

I think you have made the issue more complex.

 

Hope it could help.

Regards,

Qi

 

Best Regards,
Qi

thx for the fast aswer, but i am still getting errors...here is what i get

Hi@Magoforrest,

Could you please tell me that:

  1. if the FINALRwyCca is a LookUp column or a Number?
  2. please post the error message rather than an underlined red line that display nothing.

Qi

 

 

 

Best Regards,
Qi

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,457)