Hi, is it possible to save a custom sort order of the attribute table of a layer in a web map?
When I open the attribute table of a layer it seems the records are sorted by default on OBJECTID. Within the table one can sort ascending/descending on a particular field. But is it possible to save this custom sort within the map? So that next time I open the web map, the custom sort is applied by default for that particular layer.
My understanding is that the best way to accomplish this is to:
Adjust the order in which you want the attributes to show up on the mxd.
Click on the Layer, Properties and use the Up and Down arrow to move the Attributes in order.
You can also create alias here (or better yet back in the original source) that will then be used on the pop ups.
You cannot adjust the Attribute order in the source data, you have to do this on the mxd.
Then, republish the mxd and you should have what you want.
I have been told that you can also save the Layer from the Portal Map and then other Portal maps will work with changes to that layer. I have had better luck with changing the mxd. Plus changes to the mxd flow through to anywhere that the mxd is used or published.
Thx Paul, but my question was about the sort order of the records themselves (sorry if I was not clear).
The portal layer has an attribute "CODE". When I open the layer's table ("Show table") in the portal, by default the records are sorted ascending by "OBJECTID". What I tried to accomplish is that when a portal user opens the layer table it is by default sorted by "CODE" instead of "OBJECTID".
So, in the mxd I sorted the records by "CODE" and saved it. But apparently after publishing the mxd, my custom record sort is not saved in the portal layer.
Ah, thanks for that clarification.
That's a good question. I believe you are correct and the data is only sorted by Object ID.
This would be a nice enhancement to persist a table sort with layer or map.
It does seem that a Portal map will persist the table sort across that map's on-screen lifetime. Not sure if the same behavior translates to a web app
You can enter suggestions for improvements at the GeoNet Ideas site:
(I didn't see a similar idea in the ArcGIS-Portal section.)
I can think of a work around but it's not very pretty and probably more trouble than just teaching an end user how to sort the table on CODE: You could take your underlying data source, sort it on CODE and then copy to a new Feature Class so that ObjectID would be assigned according to the CODE sort.
But that is then in essence a static table. New records would not be sorted by CODE so you'd have to be constantly rebuilding the data source. Like I said, ugly but doable. If your mxd's data source is a Feature Class in a file geodatabase that you're pulling out of an EGDB, then you could script that transfer to build a new Feature Class sorted appropriately. That might be a viable solution for that scenario.