I have 700 Unique values “Communities” and each one of this 700 unique communities has a unique reference. For example the community “Abc” has a reference “A001”, Now I have two fields in my attribute table the first one is CommunityName and the second is REF_Number this two fields should be filled. The question now is there any method that allow me fill the field “REF_Number” based on my section form the domain of the communityName field to limit the errors and to avoid filling the data two times. For example: If I select the community Abc form the domain list then the value of the field REF_Number should be updated automatically to A001.

enter image description here

  • Not sure automatic can work for this. Do you have a spreadsheet with the two values in it? You might be able to read that into a dictionary and use field calculator or the python interactive window to update the 2nd field.
    – Branco
    Feb 27 '15 at 20:35
  • 1
    I think this may be a duplicate of gis.stackexchange.com/q/96153
    – PolyGeo
    Feb 27 '15 at 20:59
  • PolyGeo is pointing you to the right direction. Use subtypes with your FeatureClass. Feb 27 '15 at 21:17
  • @mapperz I disagree that this question is a duplicate of the one marked - that question does not in any way address automatically populating a field based on another field. gis.stackexchange.com/questions/33921 would be a better candidate for marking as a duplicate.
    – Chris W
    Feb 28 '15 at 0:11
  • Thanks guys, I saw gis.stackexchange.com/q/9615 before posting my question, using subtypes isnt what I am searching for since I need to MANUALLY enter 700 subtypes which is very hard to do. I am searching for automated method to do this. Feb 28 '15 at 8:43

The comments point to a question about creating sub-types, which is basically a domain within another domain. This would allow you to restrict the code field so that only one value was valid for a given value in the name field, but at best that means you can pick it from a dropdown - it will not fill it in automatically. As discussed at Coded Geodatabase Domain Values behaving oddly with special characters in the description field domains are only enforced at time of validation. It also means that with 700 values, you'd need 700 sub-types. That is not an efficient way to do this.

Basically you want two fields to represent the same conceptual value. There are only two ways I know of to do this automatically. One is create a Feature Template, which stores what all or some of the attributes for a new feature should be. But again, you're looking at 700 feature templates, so not really practical. The other way involves what are known as triggers and may or may not be available depending on your underlying database. Another question here, Automatically update field value in one column based on change to another column in same table? talks about their use.

You could also create a lookup table of name/code, and then use a script to Join Field (or update) the code based on name. However that doesn't happen as you edit - it's something that must be run on the table after it's been edited, either on some regular basis or manually. (The script could also be run as the result of a trigger.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.