Lists and Tables: Sort by function not working for certain fields

573
1
Jump to solution
09-06-2023 12:43 PM
Labels (1)
Vinzafy
Occasional Contributor

Hey all,

Hoping someone can help with this issue I'm facing regarding lists and tables.

Issue

When trying to add fields in the "Sort by" function for lists and tables, only certain fields seem to work. In the example below, I'm trying to sort by "Response Team Name", however when I click the field, it does not appear as an item to sort by, yet it does manipulate the order of the list.

0230906_list_sorting_i.gif

Furthermore, some fields (like "Province") do seem to work as they appear as a sort by field. Oddly, when removing one instance of "Province", it remains for a few times which seem to be the initial fields that were selected (and present in the JSON), yet not displaying.

0230906_list_sorting_ii.gif

Additionally, when checking the JSON, for the initial fields that do not appear, it does write an "orderByFields" statement, but does not show up in the GUI for certain fields.

Vinzafy_0-1694023372467.png

I also tried editing the JSON directly to see what would happen and it resulted in the same behaviour.

Likely Cause

The data source for the affected lists and tables is an Arcade Data expression which I'm guessing is the issue. The data expression performs a join from a parent dataset to three child tables as I could only achieve one join in a view layer. 

However, the weird thing is that a field that works (e.g., "Province") is the exact same field type in both the hosted feature layer and the data expression (esriFieldTypeString) as fields that do not work (e.g., "Response Team Name").

The data expression that I used as a foundation to build mine can be found on the Github page here:

Join Layer Fields to Table 

Question

Has anyone experienced this issue with sorting before or have some ideas on how to troubleshoot it? I'm going to try another data expression with only a single join and see if that behaviour persists, but thought I'd ask here.

Thanks all.

0 Kudos
1 Solution

Accepted Solutions
Vinzafy
Occasional Contributor

UPDATE: I found the cause of the issue! The process I used to create a data expression that joins related tables together (based off of this Github page) had an issue with it.

When building the dictionary that is returned as the FeatureSet for the data expression, the field names I used were formatted like aliases. E.g., Event Date vs. EventDate.

Sorting and filtering would work on fields where the names met field name criteria (i.e., no spaces, special characters, etc.), but would not work otherwise.

Changing field names to PascalCase solved the initial issue I was experiencing. I can now sort, filter, etc. all fields in the data expression as expected!

View solution in original post

0 Kudos
1 Reply
Vinzafy
Occasional Contributor

UPDATE: I found the cause of the issue! The process I used to create a data expression that joins related tables together (based off of this Github page) had an issue with it.

When building the dictionary that is returned as the FeatureSet for the data expression, the field names I used were formatted like aliases. E.g., Event Date vs. EventDate.

Sorting and filtering would work on fields where the names met field name criteria (i.e., no spaces, special characters, etc.), but would not work otherwise.

Changing field names to PascalCase solved the initial issue I was experiencing. I can now sort, filter, etc. all fields in the data expression as expected!

0 Kudos