Hi all,
I'm trying to use an Arcade expression in my web map pop-up to list the most current inspection reading for a point. I have a set of location points with a related 1:M inspection table which includes numerous readings per point (with dates) recorded over the last several months. This is what I have:
var Ra=(FeatureSetByRelationshipName($feature,"Bal2021"));
var Rb=Reverse([Ra]);
return First(Rb);
Test returns the entire array in chronological order. Can anyone please suggest how I could display just the most current reading?
Solved! Go to Solution.
In case anyone else may need it, I was able to figure out a solution by following along with this post and making some modifications. Here's what I ended up with:
var Ra = OrderBy(FeatureSetByRelationshipName($feature,"Bal2021"), "Date_Time DESC");
var cnt = Count(Ra);
if (cnt > 0) {
var Rb = First(Ra).RaDe;
} else var Rb= "";
return Rb;
Reverse returns an Array. What you probably want is OrderBy, which will return a FeatureSet. Calling First on the FeatureSet will give you the individual features.
var Ra = FeatureSetByRelationshipName($feature, "Bal2021");
var Rb = OrderBy(Ra, 'your-date-field DESC');
return First(Rb);
Also, this will just return a single Feature. If you're looking for a reading value, you would need to access that specifically.
First(Rb)['reading-value-field']
Hm. Could you paste a sample of the Ra FeatureSet? And also the Rb FeatureSet you're getting when you attempt to sort it?
I don't see any. You can paste images directly in your message, too.
In case anyone else may need it, I was able to figure out a solution by following along with this post and making some modifications. Here's what I ended up with:
var Ra = OrderBy(FeatureSetByRelationshipName($feature,"Bal2021"), "Date_Time DESC");
var cnt = Count(Ra);
if (cnt > 0) {
var Rb = First(Ra).RaDe;
} else var Rb= "";
return Rb;
I'm trying to display quarterly inspection results in my pop ups but it's proving to be more difficult than I thought. Here's an example:
var tbl = Orderby(FeatureSetByRelationshipName($feature,"Day10Rem"), "Rem10Date");
var tbc = OrderBy(FeatureSetByRelationshipName($feature,"Day10Rem"), "Rem10Conc");
var Qc = IIf(tbl >= Date(2021,6,1) && tbl < Date(2021,10,1), "Rem10Conc", "");
return Qc
Could anyone please point me in the right direction or offer suggestions?