Calculating number of characters in a field.

1021
1
Jump to solution
09-21-2021 12:32 PM
V1212
by
New Contributor II

Is it possible to calculate the number of characters in a field? I've tried using Count() but the expression doesn't work. 

var lengthArray= [$feature.id]

if (count(lengthArray)!=10)

{

return false;

}

else return true;

 

Thanks in advance! 

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

Why are you creating a list/array? the count is always going to be 1.

var length = Count(Text($feature.id))

if (length != 10) {
  return false
}
else {
  return true
}

View solution in original post

1 Reply
DavidPike
MVP Frequent Contributor

Why are you creating a list/array? the count is always going to be 1.

var length = Count(Text($feature.id))

if (length != 10) {
  return false
}
else {
  return true
}