How to remove right spaces on a field selected to create symbology -> catagories -> unique

290
2
04-19-2022 04:58 AM
Labels (1)
JoseSanchez
Occasional Contributor III

Hello everyone,

I added a layer in a map and created unique categories selecting a text field. The problem now is that this field sometimes has blank spaces on the right so the values are not selected.

Is there a way to truncate all empty characters from a text field in the symbology section?

 

Thanks

0 Kudos
2 Replies
RobertBorchert
Frequent Contributor III

You will need to remove the spaces in the table. 

the trim command should remove leading and trailing spaces from a field in a calculate field

trim($feature.<field>)

0 Kudos
DanPatterson
MVP Esteemed Contributor

or with the python parser, there are lots of options ...

a = "your field   "
a.strip()
'your field'

b = "    your field   "
b.strip()
'your field'

c = "    your field   "
c.rstrip()
'    your field'

c.lstrip()
'your field   '

 


... sort of retired...
0 Kudos