Good morning folks, hope all is well, so i have a field say attribute1 that has "Yes", "No" and "NA" list values to choose from in the Field Maps survey.
Then i have another field say attribute2 that will be auto-populated such that whenever the user select Yes, Arcade will count it and return "Value 1" the first time. Similarly, the next time the user select "Yes", Arcade will return "Value 2" and so on kind of like a counter.
Desired output:
Attribute1 Attribute2
Yes Value 1
Yes Value 2
No <Null>
No <Null>
NA <Null>
Yes Value 3
Arcade expression:
// Store the layer as a variable
var layer = FeatureSetByName($map, "sf")
// Filter the attribute value
var YesVal = Filter(layer, "attribute1" == "Yes")
// Count the number of "Yes" features
var YesCount = Count(YesVal)
// If the current feature's attribute is "Yes", add 1 to the count
if ($feature.attribute1 == "Yes") {
return "Value", yesCount + 1;
} else {
return null;
}
Error:
Test execution error: t.charAt is not a function. Verify test data.