Solved! Go to Solution.
>>> phoneBook = {'Bob': 4566461, 'Jane': 8954556}
>>> phoneBook['Bob'] 4566461
# userValue represents what the user selected, i.e. userValue = 'Alpine' officeCodeDict = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA'} # databaseValue is what you send to the database databaseValue = officeCodeDict[userValue] # so, if userValue is Alpine, databaseValue is AL
>>> phoneBook = {'Bob': 4566461, 'Jane': 8954556}
>>> phoneBook['Bob'] 4566461
# userValue represents what the user selected, i.e. userValue = 'Alpine' officeCodeDict = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA'} # databaseValue is what you send to the database databaseValue = officeCodeDict[userValue] # so, if userValue is Alpine, databaseValue is AL
if (officeCodeDict.has_key(userValue)): myVal= siteDict[userValue] else: print "not an acceptable value"R_
#Sets parameters (attributes) Office = gp.GetParameterAsText(0) Forester = gp.GetParameterAsText(1) Status = gp.GetParameterAsText(2) officeDomain = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA', 'Corpus Christi': 'CC', 'Conroe': 'CO', 'Crockett': 'CR', 'Crockett':'CR', 'College Station': 'CS', 'Canyon': 'CY', 'Dallas': 'DA', 'El Paso': 'EP', 'Fort Worth': 'FW', 'Gilmer': 'GI', 'Granbury': 'GR', 'Hamilton': 'HA', 'Henderson': 'HE'} officeCode= officeDomain[Office] foresterDomain = {'Brittany Compton': 'bcompton', 'Brian Pope': 'bpope', 'Buster Robinson': 'brobinson', 'Clay Bales': 'cbales', 'Daniel Duncum': 'dduncum', 'Daniel Lewis': 'dlewis'} foresterCode = foresterDomain[Forester] #Create Update Cursor rows = arcpy.UpdateCursor("Stewardship") #Update Forester for row in rows: if (officeDomain.has_key(Office)): row.Office = officeCode rows.updateRow(row)