0

I have one field with Zoning Codes (i.e.: RS) and I want to update another field with the string "Residential Single Family". The new field is currently NULL, I would like to add the full text string of the zoning codes. The field name containing the current code value is: [ZONING] and the new field is [ZONING_CLASS].

  • What happens if you add [ZONING] in the field calculator for the ZONING_CLASS field? – Aaron Feb 12 '15 at 23:06
  • It will maintain the current code, "RS". I would like the ZONING_CLASS field to say "Residential Single Family". I have 8 values, so if the value in [ZONING] field is RS, the [ZONING_CLASS] field wills ay "Residential Single Family, if the [ZONING] field is IL, the [ZONING_CLASS] field will say "Light Industrial". – Brian McLeer Feb 12 '15 at 23:07
  • You will need a lookup table (Two fields one with "RS", the other with "Residential Single Family") then join the table based on Zoning field and calculate the zoning_class on the joined field. There should be one row in the table for each unique Zoning value (use summary statistics to get the unique values of the Zoning field). – Michael Stimson Feb 12 '15 at 23:14
2

From an article below, I answered the question. The final code was:

https://stackoverflow.com/questions/8990864/calculating-subtypes-and-coded-values-in-arcgis-attribute-table

Pre-Logic Script Code:

Dim ValueToConvert
Dim ConvertedValue

ValueToConvert = [ZONING] 

Select Case ValueToConvert
Case "RS"
  ConvertedValue = "Single Family Residential"
Case "RSN"
  ConvertedValue = "Nodal Single Family Residential"
Case "R1S"
  ConvertedValue = "Retirement Community Single Family Residential"
Case "RM"
  ConvertedValue = "Medium Density Residential"
Case "RMN"
  ConvertedValue = "Nodal Medium Density Residential"
Case "CO"
  ConvertedValue = "Commercial Office"
Case "CG"
  ConvertedValue = "Commercial General"
Case "DDC"
  ConvertedValue = "Downtown Development & Conservation"
Case "MUV"
  ConvertedValue = "Mixed Use Village"
Case "IL"
  ConvertedValue = "Light Industrial"
Case "IP"
  ConvertedValue = "Industrial Park"
Case "P/SP"
  ConvertedValue = "Public and Semi-Public"
End Select

Output =ConvertedValue

ZONING_CLASS =

Output
  • That works too (+1 for field calculator). Consider the comment previously for lookup tables - especially pertinent for more than a few 'from' values (like regional ecosystems with hundreds of codes). Note that VB syntax is depreciating, although it works it would better serve in python - but python doesn't have switch case stackoverflow.com/questions/11479816/…. – Michael Stimson Feb 13 '15 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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