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 II
Super User II

@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

 

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

 

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

 

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (36,710)