Select to view content in your preferred language

Add an Arcade expression to a table

180
5
Tuesday
Status: Needs Clarification
Labels (1)
BerendVeldkamp
Frequent Contributor

I have a featureclass containing an ID field that has string values with a combination of numbers and letters such as 1, 11a, 11b, 100. I would like to sort these based on their numerical value, so that instead of 1, 100, 11a, 11b it will sort like 1, 11a, 11b, 100.

I looked into adding an Arcade expression, and I managed to extract the numerical value, which I can add to a popup. 

However, there seems to be no way to add the expression as an additional (dynamically calculated) field to a table. Could this be added to ArcGIS Pro?

(BTW My  true goal is to sort a table frame on a pagelayout, so maybe there are other ways to accomplish that)

 

One obvious workaround would be to add an extra field, and use an attribute rule to calculate its value, but if possible at all, I'd like to prevent this, because it's really data duplication.

 

Related posts:

 

5 Comments
BruceHarold
Status changed to: Needs Clarification

Would an option to apply natural sort order work for you?

https://en.wikipedia.org/wiki/Natural_sort_order

 

BerendVeldkamp

Hello @BruceHarold,

I just tested this naturalsort algorithm in C# (https://github.com/tompazourek/NaturalSort.Extension), and it seems to do exactly what I am after. Is this something that could be implemented in Pro? 

 

As a short-term solution, would it be possible for me to add such an algorithm using an add-in? Let's say, a button that sorts a tableview, or a table frame on a pagelayout.  (I am a developer)

AlfredBaldenweck

Check out this Idea as well: Virtual Attributes (ad hoc) - Esri Community

I thought that there was already an Idea for this for Arcade but I can't find it.

 

BerendVeldkamp

Alfred,

Yes, that would be useful too. I don't really care if it's Python, SQL or Arcade, as long as it allows me to extract a numeric value from a text (e.g. 11a ‒> 11)

But natural sort would maybe make more sense, if it sorts 11a and 11b in the correct order

BruceHarold

@BerendVeldkamp I have alerted the appropriate Pro product manager to the option to implement natural sort order, this may become an idea or someone may implement an add-in, so stand by.  I'm used to the function in Data Interoperability extension, but that isn't useful in Pro interfaces like tables.