cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
cyarbrough
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

v-xida-msft
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

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

v-xida-msft
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

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

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

 

 

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

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

Top Solution Authors
Top Kudoed Authors
Users online (46,466)