cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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
Highlighted
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
Highlighted
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

Highlighted
Helper V
Helper V

Re: Sorting Text Fields

@RandyHayes  That should solve it, thanks!

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,796)