Feature Info Widget - Related Inspection Table Sorting by Most Recent Date. Not Possible?

09-27-2022 12:44 PM
Occasional Contributor III

I created a feature info widget that is my related table.  The feature's related table is sorted by the date descending in the web map, but that setting seems to be not honored when it is brought into ExB when I click on a feature.  The oldest record shows up first with an arrow to scroll to the newer record, which can be fairly annoying if there are a lot of inspections on a feature and you want to see the latest inspection first, while also wanting to see the rest....

0 Kudos
2 Replies
New Contributor II

I used an arcade expression to solve this issue. In this script, I'm only returning the latest result so you'll have to edit that.  I hope this helps

var relatedrecords = OrderBy(FeatureSetByRelationshipName($feature,"myFeatureLayer"), 'Effective_Date DESC');
var cnt = Count(relatedrecords);

var relatedinfo = "";
if (cnt > 0) {
var info = First(relatedrecords);
relatedinfo = Text(ToLocal(info.Effective_Date), "MM/DD/Y");

return relatedinfo;

0 Kudos
Esri Contributor

Hi @ArmstKP ,

Thanks for sharing your problem.
The sorting you saved in the map is not honored into FeatureInfo, it only honors the popup setting. So one workaround is like @JessicaRamirez1 suggested using an arcade expression. Or inside ExB, at the datasource, you can create a data view of this related table to sort on select field and then use it in FeatureInfo.