@XanderBakker
Ah I see. I am perplexed by my data. This was created via Pro with a named relationship class based on GlobalID/GUID, however this is what I see via the REST endpoint. I would have expected to see the relationship class name that I defined in Pro before I published these data to ArcGIS Online.
Out of curiosity, I added this layer to a new map and went into the pop-up to add a new expression. I clicked through $feature like you mentioned, found related records at the bottom and then clicked FeatureSetByRelationshipName to add it into the builder window. This is what I see.
FeatureSetByRelationshipName($feature,"")
Here is the Arcade I attempted...I am now getting the "Unable to execute Arcade script" message again, even though it returns the correct number of records when I click "Test":
var p = 'https://www.arcgis.com';
var itemID_CMpts = 'xxx';
var layerID_CMpts = 0;
var relationshipName = "";
var fs1 = Filter(FeatureSetByPortalItem(Portal(p), itemID_CMpts, layerID_CMpts, ['Point_Status', 'EQ_File_Number'], false), "Point_Status ='Unstable' AND EQ_File_Number In ('EQ2015-078', 'Eq2013-026', 'EQ2018-082', 'EQ2018-052', 'EQ2001-080X', 'EQ2003-021', 'EQ1989-015', 'EQ2002-023', 'EQ2002-045X', 'EQ2019-110', 'EQ2020-017', 'EQ2019-091', 'EQ2018-029', 'EQ2020-033', 'EQ2019-036', 'EQ2020-052', 'EQ2019-064', 'EQ2017-040', 'EQ2020-031', 'EQ2021-003', 'EQ2011-016', 'EQ2017-026', 'EQ2021-020')");
var tot = 0;
for (var f in fs1) {
var fs2 = FeatureSetByRelationshipName(f, relationshipName, ['Point_Status_revisit'], false);
var cnt = Count(fs2);
if (cnt == 0) {
tot += 1;
}
}
return tot;
Erica