<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Filter list of values - Choose Description but code sent to database in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113049#M8821</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Matthew, but can you be a little more specific? Do you have any similar examples? thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Jul 2013 15:33:17 GMT</pubDate>
    <dc:creator>ionarawilson1</dc:creator>
    <dc:date>2013-07-02T15:33:17Z</dc:date>
    <item>
      <title>Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113047#M8819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am a newbie to Python but eager to learn. I need to create tools in ArcMap to enter and edit data. Users will need to enter for example the name of the office they work, so I created domains for that. So let's say the user completed a task in Alpine, then he would enter Alpine in the drop-down box. So for each office there is a domain. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code&amp;nbsp;&amp;nbsp; Description&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alpine&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Austin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Carthage&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And so on...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that I need the user to see the description in the dropdown box but the code to be sent to the database when he chooses an office name. So for example he would choose Austin, but the database would record AU in the office field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The way it is now, when I create the parameters using the out-of-the-box properties of the script, I have to use the Filter and enter a value list. However,&amp;nbsp; if I use the description value in the list of values (which is want I want) , this description will be recorded in the table. For example if the user chooses Austin, Austin would be recorded in the database, instead of AU. Is there a way to change this? I was reading about tool validators but I have no idea how to use it. Thank you for any help you can provide!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 13:02:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113047#M8819</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-02T13:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113048#M8820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just use a dictionary with the domain value/description so you can reference one with the other.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 13:25:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113048#M8820</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-07-02T13:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113049#M8821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Matthew, but can you be a little more specific? Do you have any similar examples? thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 15:33:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113049#M8821</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-02T15:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113050#M8822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ionara,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Really don't make tools, so not sure what an editing tool would do.&amp;nbsp; Since it will be running in ArcMap, if there is a way to open the Attribute window (from editor) (perhaps a template mxd with your tool), then they would be able to pick all the domain values directly from the dropdown in the attribute window itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would be active for either selected features, or newly created features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;not sure if this helps at all, just thougth I'd point it out if you weren't already familiar with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 17:26:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113050#M8822</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-07-02T17:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113051#M8823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;rzufelt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know we could use that, but we want to make sure the users will be entering all the records. Creating a tool insures that because the script does not run if they don't choose all the parameters but an user can leave a record blank when editing the feature in the table of attributes. At least I haven't found a good way to prevent that. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 15:07:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113051#M8823</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-03T15:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113052#M8824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Only way I can think of would be when you create the fields, set it to not allow null values.&amp;nbsp; This way, "something" would have to be entered, but could be anything that meets the field type, would not be restricted to your list (except, of course, for the fields that have a domain on them).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 15:34:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113052#M8824</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-07-03T15:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113053#M8825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ionara, I will elaborate on mzcoyles solution, as it is the right one for this situation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A Python dictionary is a way of storing information under 'keys'. A dictionary will return a value when supplied the correct key. For example, a dictionary of phone numbers (name is key, phone number is value):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; phoneBook = {'Bob': 4566461, 'Jane': 8954556}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The dictionary is constructed by wrapping it in curly braces. The names are strings, so they have quotes around them, while the numbers are stored as numbers. The : indicates that the value corresponds to the key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I query the phoneBook dictionary with the key for Bob, his name, it will return his phone number:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; phoneBook['Bob'] 4566461&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in your case, something like this should work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; # userValue represents what the user selected, i.e. userValue = 'Alpine'&amp;nbsp; officeCodeDict = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA'}&amp;nbsp; # databaseValue is what you send to the database databaseValue = officeCodeDict[userValue]&amp;nbsp; # so, if userValue is Alpine, databaseValue is AL&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 21:04:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113053#M8825</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-03T21:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113054#M8826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;and to check if the key exists then do something, I use this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (officeCodeDict.has_key(userValue)):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myVal= siteDict[userValue]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "not an acceptable value"

&lt;/PRE&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113054#M8826</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T06:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113055#M8827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Stacy and Rhett. You guys are awesome!!!:o&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;


#Sets parameters (attributes)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Office =&amp;nbsp; gp.GetParameterAsText(0)

&amp;nbsp;&amp;nbsp;&amp;nbsp; Forester = gp.GetParameterAsText(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Status =&amp;nbsp; gp.GetParameterAsText(2)

&amp;nbsp;&amp;nbsp;&amp;nbsp; officeDomain = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA', 'Corpus Christi': 'CC', 'Conroe': 'CO', 'Crockett': 'CR',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Crockett':'CR', 'College Station': 'CS', 'Canyon': 'CY', 'Dallas': 'DA', 'El Paso': 'EP', 'Fort Worth': 'FW',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Gilmer': 'GI', 'Granbury': 'GR', 'Hamilton': 'HA', 'Henderson': 'HE'}
&amp;nbsp;&amp;nbsp;&amp;nbsp; officeCode= officeDomain[Office]
&amp;nbsp;&amp;nbsp;&amp;nbsp; foresterDomain = {'Brittany Compton': 'bcompton', 'Brian Pope': 'bpope', 'Buster Robinson': 'brobinson',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Clay Bales': 'cbales', 'Daniel Duncum': 'dduncum', 'Daniel Lewis': 'dlewis'}
&amp;nbsp;&amp;nbsp;&amp;nbsp; foresterCode = foresterDomain[Forester]



#Create Update Cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor("Stewardship")

&amp;nbsp;&amp;nbsp;&amp;nbsp; #Update Forester
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (officeDomain.has_key(Office)):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Office = officeCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:44:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113055#M8827</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-11T06:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113056#M8828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Also, one last question: Do I have to create an update cursor fo every field? I tried having just one update cursor for all fields and it works but does that cause data locks? Should I create one cursor for each cursor and keep deleting the rows so as to remove data locks? Thank you!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2013 16:51:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113056#M8828</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-05T16:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113057#M8829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ionara,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Issues with data locks are not a result of updating multiple fields at the same time (I mean, they are just as likely to be an issue for multiple fields as one field).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can definitely update multiple rows. If you have 10.1, I recommend you use &lt;/SPAN&gt;&lt;STRONG&gt;da.UpdateCursor&lt;/STRONG&gt;&lt;SPAN&gt; in conjunction with the &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;with&lt;/STRONG&gt;&lt;SPAN&gt; statement, described &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000" rel="nofollow noopener noreferrer" target="_blank"&gt;here&lt;/A&gt;&lt;SPAN&gt;. Using the &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;with&lt;/STRONG&gt;&lt;SPAN&gt; statement guarantees that data locks are cleared. You can use it like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create Update Cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("Stewardship", (Office, Forester)) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # row comes back as a tuple in the order specified here, so Office is row[0], Foester is row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = officeCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = foresterCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;When it leaves the indented block it will clear up any data locks on the feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using 10.0 you can update multiple rows like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create Update Cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor("Stewardship")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Office = officeCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Forester = foresterCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I removed your check for key validity (&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;if (officeDomain.has_key(Office)):&lt;/SPAN&gt;&lt;SPAN&gt;). You mentioned that the values come from a dropdown list, so you have control over what values the user can possibly select, and thus they cannot enter a value that isn't in the dictionary...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the user is entering text, instead, you could do something like this, which will print out an error message and exit the script if they enter an invalid value (note that I have also put the dictionary creation at the top as you only need this to happen once each time the script runs):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# set up the dictionaries
officeDomain = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA', 'Corpus Christi': 'CC', 'Conroe': 'CO', 'Crockett': 'CR',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Crockett':'CR', 'College Station': 'CS', 'Canyon': 'CY', 'Dallas': 'DA', 'El Paso': 'EP', 'Fort Worth': 'FW',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Gilmer': 'GI', 'Granbury': 'GR', 'Hamilton': 'HA', 'Henderson': 'HE'}
foresterDomain = {'Brittany Compton': 'bcompton', 'Brian Pope': 'bpope', 'Buster Robinson': 'brobinson',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Clay Bales': 'cbales', 'Daniel Duncum': 'dduncum', 'Daniel Lewis': 'dlewis'}

#Sets parameters (attributes)
Office =&amp;nbsp; gp.GetParameterAsText(0)
Forester = gp.GetParameterAsText(1)
Status =&amp;nbsp; gp.GetParameterAsText(2)

# check parameters are valid&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if officeDomain.has_key(Office):
&amp;nbsp;&amp;nbsp;&amp;nbsp; officeCode= officeDomain[Office]
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('ERROR: Invalid value entered for Office: %s' % Office)
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit()
if foresterDomain.has_key(Forester):
&amp;nbsp;&amp;nbsp;&amp;nbsp; foresterCode = foresterDomain[Forester]
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('ERROR: Invalid value entered for Forester: %s' % Forester)
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit()

## Cursors, etc.
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113057#M8829</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2021-12-11T06:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113058#M8830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;HI Stacy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your first option as I am using 10.1 but I am getting an error message. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;##################################################
#
#
#Script:&amp;nbsp; Attribute Table for reporting (Stewardship)
#

##################################################

#Import modules
import os, sys, arcpy, traceback, arcgisscripting

#Set Map Document
mxd = arcpy.mapping.MapDocument("Current")

#Set Overwrite Option
arcpy.env.overwriteOutput = True


df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

gp = arcgisscripting.create(10.1)
#del row
#del rows
try:
#Sets parameters (attributes)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Office =&amp;nbsp; gp.GetParameterAsText(0)

&amp;nbsp;&amp;nbsp;&amp;nbsp; Forester = gp.GetParameterAsText(1)


&amp;nbsp;&amp;nbsp;&amp;nbsp; officeDomain = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA', 'Corpus Christi': 'CC', 'Conroe': 'CO', 'Crockett': 'CR',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Crockett':'CR', 'College Station': 'CS', 'Canyon': 'CY', 'Dallas': 'DA', 'El Paso': 'EP', 'Fort Worth': 'FW',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Gilmer': 'GI', 'Granbury': 'GR', 'Hamilton': 'HA', 'Henderson': 'HE'}
&amp;nbsp;&amp;nbsp;&amp;nbsp; officeCode= officeDomain[Office]
&amp;nbsp;&amp;nbsp;&amp;nbsp; foresterDomain = {'Brittany Compton': 'bcompton', 'Brian Pope': 'bpope', 'Buster Robinson': 'brobinson',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Clay Bales': 'cbales', 'Daniel Duncum': 'dduncum', 'Daniel Lewis': 'dlewis'}
&amp;nbsp;&amp;nbsp;&amp;nbsp; foresterCode = foresterDomain[Forester]



#Create Update Cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("Stewardship", (Office, Forester)) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # row comes back as a tuple in the order specified here, so Office is row[0], Forester is row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = officeCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = foresterCode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)


&amp;nbsp;&amp;nbsp;&amp;nbsp; #Refresh Map to reflect Changes
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()

&amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd,

except:


&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " +&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(msgs)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(pymsg)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs
&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(arcpy.GetMessages(1))
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the error - Austin is one of the options to choose for the office input in the dropdown box:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Start Time: Mon Jul 08 09:07:36 2013
Running script Stewardship32...
ARCPY ERRORS:


PYTHON ERRORS:
Traceback Info:
&amp;nbsp; File "D:\ArcGISData\SARS\Python_10April2013\BoundaryReporting_26March2013_changes_july2013_added_domain_changed_again.py", line 49, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:

Error Info:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: Cannot find field 'Austin'

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113058#M8830</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-11T06:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113059#M8831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you so much Stacy! I just need to have parenthesis around the field names!!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("Stewardship", ("Office", "Forester")) as rows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 13:37:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113059#M8831</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-08T13:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113060#M8832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have another question about other data types but I will start a new thread! Thanks again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 14:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113060#M8832</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-08T14:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113061#M8833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great! Yeah, sorry, I forgot to add the quotes!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 21:11:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113061#M8833</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-08T21:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Filter list of values - Choose Description but code sent to database</title>
      <link>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113062#M8834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,mzcoyle. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not going to answer your question,but ask you some question about arcpy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;when you answer others' threads, you mentioned that "most of the the arcpy modules are only the python interface into the geoprocessor .dlls". &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As i am confused of how arcpy make it possible for python to perform GIS functions, so i want to ask you that :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy only import GIS functions and package them and finally give us interface to use in python programming�? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;am i right�?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2013 05:23:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filter-list-of-values-choose-description-but-code/m-p/113062#M8834</guid>
      <dc:creator>miaoyananmiao</dc:creator>
      <dc:date>2013-07-09T05:23:15Z</dc:date>
    </item>
  </channel>
</rss>

