Hi
I have data collected in the field as
Depth rim to invert (A)
Depth Rim to Debris (B)
Depth Rim to Bottom (C)
I need Arcade expression for display as
If (C-B)>(C-A)/3 ‘Need Cleaning’
Else ‘No Cleaning Needed’
Here is my expression
The expression Test passed but doesn’t reflect the counts in the layers as there is one data that supposed to return “Cleaning Needed”. This is reflected as 'Other' with 0 counts.
Not sure what I am missing
Thanks in advance
Solved! Go to Solution.
Hi @KhemAryal ,
If I look at your expression and the explanation it seems that you inverted debris and invert in the conditional statement.
var A = 2.50; // rim to Invert (A)
var B = 1.60; // rim to Debris (B)
var C = 3.50; // rim to Bottom (C)
var debris = C-A; // rim to Bottom (C) - rim to Debris (A)
var invert = C-B; // rim to Bottom (C) - rim to Invert (B)
Console("debris: " + debris);
Console("invert: " + invert);
// If (C-B)>(C-A)/3 'Need Cleaning'
// Else 'No Cleaning Needed'
Console("debris/3: " + debris/3);
if (invert>debris/3) {
return 'Need Cleaning';
} else {
return 'No Cleaning Needed';
}
This returns "Need Cleaning" and it writes the following to the console:
debris: 1
invert: 1.9
debris/3: 0.3333333333333333
It looks fine to me, but the logical test is obviously failing on everything and the Else is being returned.
Perhaps it's a text field rather than a float/number? Only other suggestion is to try returning debris, invert and your logical test to debug.
Thanks @DavidPike
The field type is not text but 'Double'
Wondering how do you debug the logical test?
just label everything as debris, then invert/3 and see whats happening possibly. maybe needs to be invert/3.0 if arcade is funny that way?
Hi @KhemAryal ,
If I look at your expression and the explanation it seems that you inverted debris and invert in the conditional statement.
var A = 2.50; // rim to Invert (A)
var B = 1.60; // rim to Debris (B)
var C = 3.50; // rim to Bottom (C)
var debris = C-A; // rim to Bottom (C) - rim to Debris (A)
var invert = C-B; // rim to Bottom (C) - rim to Invert (B)
Console("debris: " + debris);
Console("invert: " + invert);
// If (C-B)>(C-A)/3 'Need Cleaning'
// Else 'No Cleaning Needed'
Console("debris/3: " + debris/3);
if (invert>debris/3) {
return 'Need Cleaning';
} else {
return 'No Cleaning Needed';
}
This returns "Need Cleaning" and it writes the following to the console:
debris: 1
invert: 1.9
debris/3: 0.3333333333333333
Hey XanderBakker
That expression now solved my problem.
You are a GEM and a great resource for us in this forum.
You're welcome @KhemAryal . I'm glad it works.
I did not notice this yesterday but Its showing different than expected on the count. there are actually total of 3187 features (not 1000). and there should be 2 counts 'need cleaning', What do you think?
Hi @KhemAryal ,
The symbology is probably limited to reading 1000 features for performance reasons. Do you need the correct statistics for the entire layer?
Yes I need to reflect all the features in the layer with the symbology. Otherwise I have to create more fields and individually insert domains - cleaning needed or not needed