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].
1 Answer
From an article below, I answered the question. The final code was:
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/…. Feb 13, 2015 at 0:08
[ZONING]
in the field calculator for the ZONING_CLASS field?