Hi all I need some help! This is my arcade expression which is resulting in all palms returning a 'Yes' value. Any clue what is wrong with my expression? Any help is appreciated.
Mahalo,
Meg
var reltbl = OrderBy(FeatureSetById($map, /* Individual Palm Damage Survey */ "Collector_Palms_9566"),"SurveyDate DES")
var cnt = Count(reltbl)
var sprdmg = ''
var borehls = ''
var inrfrnd = ''
var outfrnd = ''
if (cnt>0){
var info = First(reltbl);
sprdmg = info.SpearDamage;
borehls = info.BoreHoles;
inrfrnd = info.InnerFrondsDamaged;
outfrnd = info.OuterFrondsDamaged;
if(sprdmg == "No" && borehls == "No" && inrfrnd == "0" && outfrnd == "0"){
return "No"
}
if(sprdmg == NULL && borehls == NULL && inrfrnd == NULL && outfrnd == NULL){
return "Null"
}else {
return "Yes"
}
}
Are the InnerFrondsDamaged and OuterFrondsDamaged fields numeric or text? If they're numbers, than your first if statement should be
if(sprdmg == "No" && borehls == "No" && inrfrnd == 0 && outfrnd == 0){
Hard to tell, exactly, but the way this is written, your conditions have a few different "offramps".
My guess is that maybe point 2 is evaluating strings / integers, so it's always missed, and maybe you have empty strings, so point 3 is being missed as well?
Any chance this layer is public? It's always easier to diagnose issues with access to the data.
The two fields are strings and the other two are integers so I went with your suggestion writing it as infrnd == 0 instead. And even with just that first line of statement (removing the other lines) to test it, the value would result in Null so it must be a problem with that first line.
I found that if I made a label with a similar arcade expression instead of in the pop up, this worked and shows what palms are currently damaged vs. not.
Thank you all for your help and quick responses as well!