Field calculator to set attribute to one of two strings based on substring in another field (Pro 2.8)

309
2
Jump to solution
10-15-2021 09:28 AM
KeithAddison1
Occasional Contributor

I'm trying to set the value of the field COORDINATION based on if the field PROJECT_NUM contains the substring 'LC' or not.  The goal is to set it to either one of two strings, 'LOCAL' or 'OE/AAA'.  I wrote this snippet, the syntax validates find, but when I run it does nothing to the COORDINATION field.  Anyone know why?

KeithAddison1_1-1634315152672.png

 

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Frequent Contributor

That seems very odd. Do you accidentally have a subset of features selected, and it's only running on a few features? It would be a kind of silly mistake, but one I've made more than once.

EDIT: If you want a workaround, you could use "Select by Attributes" to identify local projects, then use the Attributes pane to bulk-update the selected features. Then simply invert the selection and bulk-update the remaining features with the other value.

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Frequent Contributor

That seems very odd. Do you accidentally have a subset of features selected, and it's only running on a few features? It would be a kind of silly mistake, but one I've made more than once.

EDIT: If you want a workaround, you could use "Select by Attributes" to identify local projects, then use the Attributes pane to bulk-update the selected features. Then simply invert the selection and bulk-update the remaining features with the other value.

- Josh Carlson
Kendall County GIS

View solution in original post

KeithAddison1
Occasional Contributor

I'm not sure if I did as I've closed everything out.  But I just tried it again and it worked.  Thanks!