I am trying to use Count() for a simple count of a string in a text field in a feature table in Pro.
It should be as simple as Count(fieldname)
Error
Works on another field
Both are text fields
Solved! Go to Solution.
Oh, right! It uses that first row to validate the script. Okay, try an expression like this:
var addr = $feature['Address_From2']
Iif(IsEmpty(addr), 0, Count(addr))
By checking if the value is null first, and explicitly giving nulls an output value, this should pass validation.
Hmmm. Does it behave any differently if you use bracket notation? As in, $feature['Address_From2']?
Oh, right! It uses that first row to validate the script. Okay, try an expression like this:
var addr = $feature['Address_From2']
Iif(IsEmpty(addr), 0, Count(addr))
By checking if the value is null first, and explicitly giving nulls an output value, this should pass validation.
Thank you @jcarlson! That does it.