I have been forced into using arcade expressions to HTML format data as part of this I have to use some related records. The relationship between the feature class and the related table is one to many or none as such some of the features do not have a related record.
for debugging purpose I have taken the relationship part out into into a separate expression what I have at moment is this
var x=FeatureSetByRelationshipName($feature, "drainageIAforms_1",['FluvfloodRisk'],false)
Console(x)
console(IsEmpty(x))
console(Count(x))
console(first(x))
var result=''
if (Count(x)>0) {
var y=first(x)
result = y.FluvfloodRisk
}
else {
result= 'No Data'
}
return {
type : 'text',
text : result
}works perfectly if there is a related record there, I get the expected return and the console populates as you would expect and it takes a reasonable amount of time to return.

When no related record exists its a totally different issue. the output flags an error and the console output stops at the count.


Even more confusing is the popup populates but is slow

I thought the count of the feature set was the way to check if there were records is there something I am missing.
Thanks in Advance if anyone has a solution