Sort order in Filter Widget

2790
13
02-02-2022 01:38 PM
RhettZufelt
MVP Frequent Contributor

Is there a way to change the sort order in the filter widget, especially to Natural Sort?

I have set up an expression using the unique values option.  Nice as it gives me the list of values to filter on, but they are sorted alphabetically, and I need a natural sort option.

Really confusing the the user when things are way farther down the list than expecting.

W1 and W2 should come before 10, and so on.

Looks like thisWant to look like this
W10-1W1-1
W11-1W2-4
W1-1W10-1
W2-4W11-1
13 Replies
TonghuiMing
Esri Regular Contributor

@RhettZufelt It appears to be the current sorting mechanism and we will take a look at it to see if it can be enhanced. Thanks for bringing it up.

RhettZufelt
MVP Frequent Contributor

Thank you @TonghuiMing, I look forward to the next update.

R_

0 Kudos
TonghuiMing
Esri Regular Contributor

@RhettZufelt - after investigation, here are some complications to your case -

If the values are just labels, then there could be a way to sort them naturally, such as the following case:

TonghuiMing_0-1645500635358.png

However, it is values that are being used for Filter > SQL in your case, thus, it may be the current designed behavior - since it says string field value by the starting 'W', it could not use the numeric logics, which will honor the natural sort order.

A workaround might be, to use 01 to distinguish 10+ numbers. Hope it could help.

0 Kudos
RhettZufelt
MVP Frequent Contributor

Thanks @TonghuiMing, however, I really can't be changing values of a standard in order to work around the sort issues.

Any chance future versions we can have full access to SQL in the Filter Widget instead of the limited set available in the drop downs?  Natural sort on this kind of data is not too difficult with SQL if we have the tools available.

Also, am I just missing it, or is there not an option to decide sort field/order in the Filter Widget other than the default sort on the Filter field?

If there were a way to sort on field of choice, I could use SQL to populate/maintain a separate column for sorting as a workaround.

 

R_

 

0 Kudos
TonghuiMing
Esri Regular Contributor

Hi @RhettZufelt - we have done some enhancements for the sorting for the release yesterday. Could you please check again and see if the natural sort works for you now? I do not know your data type/structure - are these coded values or not?

It would be nice if you could share with me the data for a quick test as well, if possible.

0 Kudos
RhettZufelt
MVP Frequent Contributor

@TonghuiMing There is a domain on the field, and my filter query looks like:

RhettZufelt_0-1648045519559.png

So it only pulls values that are currently populated in the data. 

The drop down list I get when I edit/add a feature shows the entire domain list and is sorted by the order of the domain table (so, no sort).

It appears as if the filter widget is still sorting like the previous version:

RhettZufelt_1-1648045851514.pngRhettZufelt_2-1648045856604.png

 

I tried to add you to my ESRI support group, but couldn't find @TonghuiMing.

 

Thanks,

R_

 

0 Kudos
TonghuiMing
Esri Regular Contributor

Okay, let me try creating some data similar tomorrow and give it a try first. Thanks for the info.

0 Kudos
TanGnar
Occasional Contributor

I'm running into these issues as well, but using Predefined Unique Values. I need to be able to sort the predefined values filter smallest to largest, but keep different nomenclature. See below. I can drag the predefined values to my desired order, but it does not affect the way the filter is sorting in the app. It seems that it defaults the sorting based on the Label. As a workaround, I can change the labels to get an order I need, but it's not very clean and it would be easier if the order I specify when I'm defining the values was used in the app. 

TanGnar_0-1655212055014.png

TanGnar_1-1655212208637.png

Erwinvan_Veen1
New Contributor III

Is there perhaps any update on this question @TonghuiMing? I am looking at the same thing as the others described. I would be great if the configured order is honored.

Attached I have a sample. Although in Dutch, I presume the intended order is pretty clear.

Any update would be much appreciated.