Select to view content in your preferred language

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

598
4
09-27-2022 12:44 PM
ArmstKP
Frequent Contributor

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
4 Replies
JessicaRamirez1
Emerging Contributor

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
ArmstKP
Frequent Contributor

@JessicaRamirez1 I have used scripts like this before, but where did you add the script/expression in ExB?

0 Kudos
JessicaRamirez1
Emerging Contributor

@ArmstKP  I configured the layers pop-up in the web map, the same web map that I added to EB. That's where the script lives, in the pop-up configuration option on the layer.

0 Kudos
WeiYing1
Esri Regular 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.