cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Sorting on text field on predefined order

Hi,

I want to apply sorting on text field by predefined order and not by alphabetically. 

Is it possible and how it is implemented in Power apps.

 

Thanks,

Pankaj

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Helper III
Helper III

can you explain the text field you're trying to sort on and how you want to sort it?

 

you can probably use SortByColumns to do this. documentation here.

View solution in original post

Highlighted
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a bit more about your scenario?

Do you want to sort your records based on text field (by predefined order) rather than by alphabetically?

Further, do you use the SortByColumns function within your app?

 

I suppose that you use the SortByColumns function within your app, is it true?

 

If you use the SortOrder.Ascending or the SortOrder.Descending as the sort order within your SortByColumns function, your records would be sorted by alphabetically.

 

You could also take a try to customize your soft order within your SortByColumns function. The SortByColumns function could sort based on a single column table of values, e.g. you can sort record based on the name of a day of the week by supplying [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] as the sort order. All records which have Monday" will come first, followed by Tuesday, and so on.

 

The formula format of above scenario as below:

SortByColumns( Table, ColumnName, ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"])

The standard formula format as below:

SortByColumns( Table, ColumnName, SortOrderTable)

On your side, you should type the following formula:

SortByColumns( Table, TextField, ["text1","text2","text3",...])

 

More details about the SortByColumns function in PowerApps, please check the following article:

SortByColumns function

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

Thanks all, I managed to add SortBycolumn within expression.

 

If(Dropdown1.Selected.Value = "All";Distinct(SortByColumns(Filter('Table Name';Assignedto<>"All");"Status";["New";"Reallocated";etc..]);Status);Distinct(Filter('Table Name';Assignedto = Dropdown1.Selected.Value);Status))

 

 

Thanks,

Pankaj

View solution in original post

5 REPLIES 5
Highlighted
Helper III
Helper III

can you explain the text field you're trying to sort on and how you want to sort it?

 

you can probably use SortByColumns to do this. documentation here.

View solution in original post

Highlighted
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a bit more about your scenario?

Do you want to sort your records based on text field (by predefined order) rather than by alphabetically?

Further, do you use the SortByColumns function within your app?

 

I suppose that you use the SortByColumns function within your app, is it true?

 

If you use the SortOrder.Ascending or the SortOrder.Descending as the sort order within your SortByColumns function, your records would be sorted by alphabetically.

 

You could also take a try to customize your soft order within your SortByColumns function. The SortByColumns function could sort based on a single column table of values, e.g. you can sort record based on the name of a day of the week by supplying [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] as the sort order. All records which have Monday" will come first, followed by Tuesday, and so on.

 

The formula format of above scenario as below:

SortByColumns( Table, ColumnName, ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"])

The standard formula format as below:

SortByColumns( Table, ColumnName, SortOrderTable)

On your side, you should type the following formula:

SortByColumns( Table, TextField, ["text1","text2","text3",...])

 

More details about the SortByColumns function in PowerApps, please check the following article:

SortByColumns function

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

Thanks Kris, this is exactly what i want

 

I am not able to add the Sortbycolumn in my expression having filter function can you please help me with it, 

Below is the expression i am using : 

 

If(Dropdown1.Selected.Value = "All";Distinct(Filter('[dbo].[TableName]';Assignedto<>"All");Status);Distinct(Filter('[dbo].[Tablename]';Assignedto = Dropdown1.Selected.Value);Status))

 

Where i need to apply SortBycolumn on below statement with predifined Status Order as  ["New";"Reallocated";etc..] 

 

Distinct(Filter('[dbo].[TableName]';Assignedto<>"All");Status)

Distinct(Filter('[dbo].[Tablename]';Assignedto = Dropdown1.Selected.Value);Status)

 

 

Thanks Again. 

Pankaj

 

 

 

 

Thanks,

Pankaj

Highlighted
Anonymous
Not applicable

Thanks Kris, this is exactly what i want

 

I am not able to add the Sortbycolumn in my expression having filter function can you please help me with it, 

Below is the expression i am using : 

 

If(Dropdown1.Selected.Value = "All";Distinct(Filter('[dbo].[TableName]';Assignedto<>"All");Status);Distinct(Filter('[dbo].[Tablename]';Assignedto = Dropdown1.Selected.Value);Status))

 

Where i need to apply SortBycolumn on below statement with predifined Status Order as  ["New";"Reallocated";etc..] 

 

Distinct(Filter('[dbo].[TableName]';Assignedto<>"All");Status)

Distinct(Filter('[dbo].[Tablename]';Assignedto = Dropdown1.Selected.Value);Status)

 

 

Thanks Again. 

Pankaj

 

 

Highlighted
Anonymous
Not applicable

Thanks all, I managed to add SortBycolumn within expression.

 

If(Dropdown1.Selected.Value = "All";Distinct(SortByColumns(Filter('Table Name';Assignedto<>"All");"Status";["New";"Reallocated";etc..]);Status);Distinct(Filter('Table Name';Assignedto = Dropdown1.Selected.Value);Status))

 

 

Thanks,

Pankaj

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,300)