cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DrMantas
Frequent Visitor

Sort for highest number breaks at 9

Hello,

 

I am creating an automated testing management app, which could auto-create reports, format workload and send out emails based on it.

 

For data storage I chose Excel tables, but faced the issue of creating an auto increment which is a vital part of any database.

The following function works well up to the integer 9, but when the record 10 is created it fails to give the correct highest number and instead shows 9: First(Sort(list_of_test_projects, ID, Descending)).ID

 

Issue overview:

Sort rangeFunction output
1 to 9Correct
10 and more9

 

Photo of list_of_test_projects table:

issue excel table.PNG

 

I did not use Max() as it is limited up to 2000 rows, as far as I remember.

 

Any thoughts on why this might be happening?

Cheers!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @DrMantas ,

I am not an Excel user but it sounds to me you have the numbers stored as Text, so the sequence would be 1,10,11...., 2,3,4,5,6,7..... Try

First(
   Sort(
      list_of_test_projects, 
      Value(ID), 
      Descending
   )
).ID

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @DrMantas ,

I am not an Excel user but it sounds to me you have the numbers stored as Text, so the sequence would be 1,10,11...., 2,3,4,5,6,7..... Try

First(
   Sort(
      list_of_test_projects, 
      Value(ID), 
      Descending
   )
).ID

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

timl
Super User
Super User

@WarrenBelz is correct here.

The alternative is to format the data type of your ID column as numeric from within Excel, and to then refresh your data source from the View > Data sources menu item in PowerApps.

Your app should then recognise the ID column as a number and there won't be any need for you to convert the ID value to a number in order to apply the correct numeric sort sequence.

DrMantas
Frequent Visitor

Thank you very much! It was indeed data type problem.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (2,617)