cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dyee4613
Level 8

Sorting Text Fields

Hi.  I was wondering what the best practice is for this problem I'm having.  I have an excel sheet with a list of locations and rooms.  I created a cascading dropdown for them. Some of the rooms have weird names like "big room" or e101 depending on the location which means it has to be a text field.  The PowerApps sort for this is pretty funky.  It uses the first character so my list looks like this

1,10,11,12,13,14,15,16,17,18,19,2,20 which is not ideal. 

 

Another question I have is I created a data table with the location and date.  The date field is the date + the time but for the data table I only want to show the time.  Is there an easy way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Sorting Text Fields

@dyee4613 

Question 1 - One Word...AddColumns

 

Here's a trick I use for sorting alphanumeric columns like that...

SortByColumns(
AddColumns(yourDataSource,
"textRoom", If(IsMatch(room, MultipleDigits), Right(Text(Value(room), "0000"),4), room)
),
"textRoom",Ascending)

You can ignore the textRoom for any display labels...it is only there for the sort.

 

Question 2 - One Word...AddColumns

Same thing, add a Column to your Items that is just the Time value and turn it on in the DataTable

AddColumns(yourDataSource, "TimeColumn", Text(yourDateTimeColumn, "hh:mm:ss"))

I hope that is all helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Sorting Text Fields

@dyee4613 

Question 1 - One Word...AddColumns

 

Here's a trick I use for sorting alphanumeric columns like that...

SortByColumns(
AddColumns(yourDataSource,
"textRoom", If(IsMatch(room, MultipleDigits), Right(Text(Value(room), "0000"),4), room)
),
"textRoom",Ascending)

You can ignore the textRoom for any display labels...it is only there for the sort.

 

Question 2 - One Word...AddColumns

Same thing, add a Column to your Items that is just the Time value and turn it on in the DataTable

AddColumns(yourDataSource, "TimeColumn", Text(yourDateTimeColumn, "hh:mm:ss"))

I hope that is all helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

dyee4613
Level 8

Re: Sorting Text Fields

@RandyHayes  That should solve it, thanks!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,148)