<?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: Updating 2 tables related by 3 ID fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504112#M39596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, line 230 is a print statement.&amp;nbsp; Are you sure it is executing?&amp;nbsp; You should break that whole expression down to multiple prints statements so you are certain exactly what arguments are being passed to the query and calculation.&amp;nbsp; For example, you could try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"OBJECTID={} AND CustomerID={}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;], updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;print &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 9pt !important; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;print &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 9pt !important; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;Then, if all of those inputs makes sense, execute the &lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;fl.calculate outside of a print operation.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 12px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;There are some details to pay attention to.&amp;nbsp; If CustomerID is numeric and the value makes sense, then the SQL should be fine.&amp;nbsp; But if CustomerID is a string value then the SQL should fail, since the value is not within quotes.&amp;nbsp; For a string CustomerID you would need:&amp;nbsp; &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"OBJECTID={} AND CustomerID='{}'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 9pt !important; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;&lt;SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;], updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Mar 2015 19:32:38 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2015-03-03T19:32:38Z</dc:date>
    <item>
      <title>Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504099#M39583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having a little trouble setting up this script. Here are the bullet points.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;2 Tables have the same three fields. [SiteID], [EasyID], [FeatureID]. For simplicity, lets pretend these are the only fields (besides OID).&lt;/LI&gt;&lt;LI&gt;[FeatureID] is a unique integer for each feature created in Table 1.&lt;/LI&gt;&lt;LI&gt;[SiteID] is a non-unique integer and groups features by location.&lt;/LI&gt;&lt;LI&gt;[EasyID] is a string (typically a number) unique within the same [SiteID], but not unique in the field.&lt;/LI&gt;&lt;LI&gt;Table 1 - The master table. New features have all three ID fields populated.&lt;/LI&gt;&lt;LI&gt;Table 2 - New features always have [SiteID], sometimes [EasyID], and never a [FeatureID].&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 1.5;"&gt;Table 2 - Features with [SiteID] and [EasyID], and no [FeatureID] may have a matching [SiteID] and [EasyID] in Table 1. If so, update [FeatureID] in Table 2.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Table 2 - Features missing [EasyID] need to be assigned the next number for that [SiteID] in either Table 1 or 2. If current EasyID's for a site are '1', '3', '4A', '6-7','S', and '55', new features would be '2', '4', '5', '6', '7', '8'....etc.&lt;/LI&gt;&lt;LI&gt;Table 2 - New features given a [FeatureID] when inserted into Table 1. The features are then updated in Table 2.&lt;/LI&gt;&lt;LI&gt;Table 1 - Finally, any features with a [SiteID] in Table 2, but the [FeatureID] and [EasyID] are not in Table 2, are inserted into Table 2&lt;/LI&gt;&lt;LI&gt;At the end of the script both tables should match.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked through using model builder with no luck. With python dictionaries and search cursors i'm getting stuck trying to join against [SiteID] and [EasyID] at the same time. I am also don't know how to return the dictionaries with just integer EasyID's and loop through updating the next smallest integer.&lt;/P&gt;&lt;P&gt;Here is what I've got so far. Much of it stems from what I read from &lt;A href="https://community.esri.com/migrated-users/4811" target="_blank"&gt;Richard Fairhurst&lt;/A&gt;'s post &lt;A href="https://community.esri.com/migration-blogpost/1885" target="_blank"&gt;Turbo Charging Data Manipulation with Python Cursors and Dictionaries&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #303030;"&gt;import arcpy&lt;/SPAN&gt;

&lt;SPAN style="color: #303030;"&gt;#Tables&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T1 = r"C:\Python\Scratch.gdb\Table1"&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T2 = r"C:\Python\Scratch.gdb\Table2"&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;fields = ["FeatureID", "SiteID", "EasyID"]&lt;/SPAN&gt;

&lt;SPAN style="color: #303030;"&gt;# Get FeatureID dictionaries for each Table&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T1Dict = {r[0]:(r[0:]) for r in arcpy.da.SearchCursor(T1, fields)}&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T2Dict = {r[0]:(r[0:]) for r in arcpy.da.SearchCursor(T2, fields)}&lt;/SPAN&gt;

&lt;SPAN style="color: #303030;"&gt;# Get SiteID+EasyID dictionaries for each Table&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T1ConcatDict = {str(r[1]) + "," + str(r[2]):(r[0]) for r in arcpy.da.SearchCursor(T1, fields)}&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T2ConcatDict = {str(r[1]) + "," + str(r[2]):(r[0]) for r in arcpy.da.SearchCursor(T2, fields)}&lt;/SPAN&gt;

&lt;SPAN style="color: #303030;"&gt;#First, If T2.FeatureID is Null but T2.EasyID and T2.SiteID are in T1, Update T2.FeatureID&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;with arcpy.da.UpdateCursor(T2, fields) as updateRows:&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # store the Join value by combining 3 field values of the row being updated in a keyValue variable&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = str(updateRow[1]) + "," + str(updateRow[2])&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # verify that the keyValue is in the Dictionary&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if keyValue in T1ConcatDict &amp;amp; updateRow[0] is None &amp;amp; updateRow[1] is not None:&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # transfer the value stored under the keyValue from the dictionary to the updated field: FeatureID.&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[0] = T1ConcatDict[keyValue][0]&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)&amp;nbsp; &lt;/SPAN&gt;

&lt;SPAN style="color: #303030;"&gt;#Rebuild Dictionary if it is needed again&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T2ConcatDict = {str(r[1]) + "," + str(r[2]):(r[0]) for r in arcpy.da.SearchCursor(T2, fields)}&lt;/SPAN&gt;
&lt;SPAN style="color: #303030;"&gt;T2Dict = {r[0]:(r[0:]) for r in arcpy.da.SearchCursor(T2, fields)}&lt;/SPAN&gt;


'''
#Get Max(EasyID) within SiteID
NumberList = []
for value in T1Dict[2]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NumberList.append(int(value))
&amp;nbsp;&amp;nbsp;&amp;nbsp; except ValueError:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
T1EasyNumberDict = [s[2] for s in T1Dict[2] if s.isdigit()]
T1MaxEasyDict = max(T1EasyNumberDict)
'''


#Second, If T2.FeatureID and T2.EasyID are Null, Update T2.EasyID with next smallest number (as string) in either T1 or T2 for the specific SiteID
with arcpy.da.UpdateCursor(T2, fields) as updateRows:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # store the Join value by combining 3 field values of the row being updated in a keyValue variable&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = str(updateRow[1]) + "," + str(updateRow[2])&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # verify that the keyValue is in the Dictionary&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if keyValue in T1Dict &amp;amp; updateRow[0] is None &amp;amp; updateRow[1] is None:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # transfer the value stored under the keyValue from the dictionary to the updated field.&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Perhaps retrieve max int occurs here?
&amp;nbsp; updateRow[2] = max(T1Dict[keyValue][2], T2Dict[keyValue[2]) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)&amp;nbsp; 


#Third, Insert into T1 if T2.SiteID is not null and T2.EasyID is not null


#Forth, Update T2.FeatureID with T1.FeatureID from previous insert where T2.SiteID=T1.SiteID and T2.EasyID=T1.EasyID


#Lastly, Insert any T1 features into T2 where T1.EasyID not in (Select EasyID from T2 where T2.SiteID = T1.SiteID) and T1.FeatureID&amp;nbsp; not in (Select FeatureID from T2)


&lt;/PRE&gt;&lt;P&gt;Thank you for any advise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: Here is a sample of sites with 2 explanatory columns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;T1.FeatureID&lt;/TD&gt;&lt;TD&gt;T2.FeatureID&lt;/TD&gt;&lt;TD&gt;T1.SiteID&lt;/TD&gt;&lt;TD&gt;T2.SiteID&lt;/TD&gt;&lt;TD&gt;T1.EasyID&lt;/TD&gt;&lt;TD&gt;T2.EasyID&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;TD&gt;Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;358589&lt;/TD&gt;&lt;TD&gt;358589&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;358590&lt;/TD&gt;&lt;TD&gt;358590&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;358594&lt;/TD&gt;&lt;TD&gt;358594&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;652538&lt;/TD&gt;&lt;TD&gt;652538&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;486028&lt;/TD&gt;&lt;TD&gt;486028&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;486029&lt;/TD&gt;&lt;TD&gt;486029&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;525300&lt;/TD&gt;&lt;TD&gt;525300&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;574802&lt;/TD&gt;&lt;TD&gt;574802&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;998&lt;/TD&gt;&lt;TD&gt;998&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;670911&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;493840&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;9996&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;493839&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;9997&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;493831&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;9999&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;696019&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;105-106&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;696037&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;9999N&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;696014&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Area1&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;670910&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;580636&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136238&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;N30c&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T1 Feature&lt;/TD&gt;&lt;TD&gt;(Step 6) Inserted Into T2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;360401&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136401&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;AC&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Exiting T1 Feature&lt;/TD&gt;&lt;TD&gt;(Skip) Not Inserted since no T2.SiteID match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;360402&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136401&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;SP&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Exiting T1 Feature&lt;/TD&gt;&lt;TD&gt;(Skip) Not Inserted since no T2.SiteID match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;360510&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136427&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Area 1&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Exiting T1 Feature&lt;/TD&gt;&lt;TD&gt;(Skip) Not Inserted since no T2.SiteID match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362653&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136635&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Exiting T1 Feature&lt;/TD&gt;&lt;TD&gt;(Skip) Not Inserted since no T2.SiteID match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362943&lt;/TD&gt;&lt;TD&gt;362943&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362944&lt;/TD&gt;&lt;TD&gt;362944&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362945&lt;/TD&gt;&lt;TD&gt;362945&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362946&lt;/TD&gt;&lt;TD&gt;362946&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362947&lt;/TD&gt;&lt;TD&gt;362947&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362950&lt;/TD&gt;&lt;TD&gt;362950&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;11C&lt;/TD&gt;&lt;TD&gt;11C&lt;/TD&gt;&lt;TD&gt;Existing T1 and T2 Feature&lt;/TD&gt;&lt;TD&gt;No Change&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362948&lt;/TD&gt;&lt;TD&gt;362948&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 5) Update T2.EasyID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362949&lt;/TD&gt;&lt;TD&gt;362949&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 5) Update T2.EasyID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362951&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 1) Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362954&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 1) Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362955&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 1) Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362956&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 1) Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;362957&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;New T2 Feature, Exists in T1&lt;/TD&gt;&lt;TD&gt;(Step 1) Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 3,4) Insterted into T1, Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 3,4) Insterted into T1, Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 3,4) Insterted into T1, Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 3,4) Insterted into T1, Update T2.FeatureID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 2,3,4) Get next lowest integer for T2.EasyID -&amp;gt; 6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 2,3,4) Get next lowest integer for T2.EasyID -&amp;gt; 7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 2,3,4) Get next lowest integer for T2.EasyID -&amp;gt; 10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;136698&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;New T2 Feature&lt;/TD&gt;&lt;TD&gt;(Step 2,3,4) Get next lowest integer for T2.EasyID -&amp;gt; 11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504099#M39583</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2021-12-11T22:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504100#M39584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is one of these cases where it would be so valuable to have to sample data attached to the thread. Also you could mention &lt;A href="https://community.esri.com/migrated-users/4811"&gt;Richard Fairhurst&lt;/A&gt;‌ (see &lt;A href="https://community.esri.com/migration-blogpost/2568"&gt;Tagging people, places, and content within your post&lt;/A&gt; ) since you based the script on his post. This will send him a notification and he might be able to look at your code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, please attach a sample of the data, to be able to debug the code. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 12:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504100#M39584</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-02-26T12:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504101#M39585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In what way are you getting stuck trying to &lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;join against [SiteID] and [EasyID] at the same time?&amp;nbsp; Are you getting errors?&amp;nbsp; The basic approach to a combined key will work as shown for the first 25 lines of code (I can't follow your overall logic beyond that).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Null values in the key most likely cause most of problems, so I would restructure the code order to deal with the second part of your script first to fill in Null values in the EasyID field before worrying about the FeatureID field at all.&amp;nbsp; That involves processing a list of EasyIDs in the single key dictionary of just SideID key values first to verifying the unique value assumption for the non-Null EasyID values as well as filling in the Null EasyID values.&amp;nbsp; Don't build dictionaries for T2 at all until they can be used.&amp;nbsp; In any case, the cursor dictionary approach is your best option and can handle this whole set of processes, but each must happen in the correct order to avoid faulty assumptions about what set of fields contain unique values at each stage of the script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Clearly you are dealing with a high complex interrelationship between these two tables and a large set of rules that I have yet to understand. I have no context how these records and values came into existence of what uses they will serve in the future. More crucially, You have given me no information about the interrelationship this script has with user actions.&amp;nbsp; Every step you expect a user to do or not do creates a point of failure for your script and any of your rules and assumptions.&amp;nbsp; If the user has to manually set off the script, you must always start by verifying they did everything you expected them to do and didn't do anything you didn't expect them to do related to your script assumptions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Also, Xander is correct that mentioning my full name in a post puts a message in my inbox, which is the reason I saw this post when he did that.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 13:39:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504101#M39585</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-02-26T13:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504102#M39586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good points &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌. I have included example info and fixed the mentioning. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 15:09:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504102#M39586</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2015-02-26T15:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504103#M39587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What distinguishes the skipped records from the records that were step 6 inserted into the T2 table?&amp;nbsp; I see no way to keep track of what is new in T1 since the last time the script was run to make that choice.&amp;nbsp; All of the T2 insertions and the skipped records have no SiteID, so that is not a difference to make that choice.&amp;nbsp; I don't agree that you have the steps in the correct order from what I can see.&amp;nbsp; Your logic appears backwards, since normally I would deal with Nulls and new verses old records as my first steps in any comparison script, not towards the end.&amp;nbsp; My scripts deal with new verses old by renaming existing data and deriving current data from another source, so that the comparison is easy to make.&amp;nbsp; Possibly a variation of that approach would apply here, so that a last run version of the data is created so you can make sure you know what is really new and what you have processed before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also add the ObjectID field for both tables to your field list and reorder the fields as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;["SideID", "EasyID", "FeatureID", "OID@"]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ObjectID would be used in subroutines to impose order on Null values and to validate your assumptions of unique keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway you never said if errors are occurring of if just unexpected values are being assigned.&amp;nbsp; Unexpected values indicate a logic failure, while errors indicate a syntax or data validation failure.&amp;nbsp; I am almost certain you will experience many logic errors developing and testing the script since there are so many dependencies at each stage that have to be considered, so develop only on test data and back up your data before trying it out on your live data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My blog avoided going into anything this complex, because it hopes to make the core of the principles and the approach I was demonstrating easy to follow.&amp;nbsp; You may want to look at &lt;A href="http://gis.stackexchange.com/questions/133496/how-to-use-iterators-in-modelbuilder-to-create-new-feature/133549#133549"&gt;this post&lt;/A&gt; to see an example of where I adapted the approach to deal with a much more complex many-to-many relationship between tables for further ideas about ways to vary the basic approach outlined in the Blog.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 15:43:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504103#M39587</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-02-26T15:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504104#M39588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This script will run at night. The T1 features that don't have a Site ID in T2 are basically ignored until the T2 user adds the first feature with that SiteID. The user may have manually matched the SiteID and EasyID  before the script runs. Additionally, T2 users adding the first occurances of features in either table will skip adding EasyID and rely on unique ones being generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One other note is once a feature has all 3 ID'S it will never be changed by the users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps if I pre filter T1 to T2 SiteID, the script would be simpler. I believe you have identified  step 1 as redundant since it occurs later and max(EasyID) is gained across both tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 16:21:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504104#M39588</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2015-02-26T16:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504105#M39589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;I haven't gotten far enough to get any errors. I don't know how to build/filter the dictionary for T2.OID T2.SiteID string EasyID, then gather only integer EasyIDs, and return the 1st missing integer starting from 1. Without it I can't test updating Null EasyIDs in new T2 features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting that &lt;A href="http://gis.stackexchange.com/questions/133496/how-to-use-iterators-in-modelbuilder-to-create-new-feature/133549#133549"&gt;link to stackexchange&lt;/A&gt;! It looks very similar the components of my scenario. I will update after testing the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 15:40:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504105#M39589</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2015-02-27T15:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504106#M39590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your approach still mystifies me and I still don't understand your business rules.&amp;nbsp; Your rules may make sense to you and may be correct for your business needs, but on the surface they at least partially conflict with my experience in synchronizing data and matching tables.&amp;nbsp; The picture in your head of how everything should work is not transferring into mine yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I highly recommend that you reconsider the rule that says:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Table 2 - Features missing [EasyID] need to be assigned the next number for that [SiteID] in either Table 1 or 2. If current EasyID's for a site are '1', '3', '4A', '6-7','S', and '55', new features would be '2', '4', '5', '6', '7', '8'....etc.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The EasyID is anything but easy to understand or program as you have described it.&amp;nbsp; Filling in these blanks this way seems arbitrary to me especially given that the natural sort of the strings is actually '1', '3', '4A', '55', '6-7', 'S'.&amp;nbsp; Why fill in blanks at all?&amp;nbsp; Over time that means any deleted records will have their SiteID + EasyID combination reused for an entirely unrelated record, and therefore that key is only unique within the snapshot in time before the script reuses it.&amp;nbsp; In other words, you will never be able to use the SiteID + EasyID key if you ever have to compare two different data snapshots that were taken before and after the script ran.&amp;nbsp; This rule may make sense to you, but in my experience this is a bad database practice.&amp;nbsp; Unique keys (single or multi-field) are only valuable in my experience if they are unique to one record over all time or support actual data relationships and become a problem if they are ever reused for completely unrelated records.&amp;nbsp; I personally don't want to help implement this rule, since its seems excessively complicated to me, and I believe from experience that a day will come when you will want to use that key to recover from a data corruption event and the code that implements this rule will make that recovery nearly impossible.&amp;nbsp; You also will greatly increase the likelihood of creating data corruption if you accidentally link together two snapshots that reassigned the same keys to different records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have several other questions about this EasyID field.&amp;nbsp; How many characters are allowed in this field?&amp;nbsp; Why does it contain letters and what is the significance of those letters?&amp;nbsp; Why are there dashes to combine two numbers?&amp;nbsp; Since this field is a string field, how do your users handle the fact that it will never sort numerically in any table, since you don't include leading spaces or strings to right-justify them?&amp;nbsp; What type of business are you working for where this business process was developed to track any of this data in either table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what little I do understand (or think I understand) I will try to present some code that should fit your needs. This code is more or less what I would start with.&amp;nbsp; Key fields always should come first in the field list and value fields always should follow.&amp;nbsp; I would incorporate the OID field into the code processes and dictionaries as a fail safe unique key for linking back to the original table where ever the user defined keys turn out to be duplicated and not unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code below handles both a 1:1 and 1:M relationship possibility, so even if the key value is not unique you will be able to trap that and fix it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;import arcpy&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;import sys&lt;/SPAN&gt;

&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN class="comment" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: #008200;"&gt;#Tables&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;T1 = r&lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: blue;"&gt;"C:\Python\Scratch.gdb\Table1"&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;T2 = r&lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: blue;"&gt;"C:\Python\Scratch.gdb\Table2"&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;fields = [&lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: blue;"&gt;"SiteID"&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: blue;"&gt;"EasyID", &lt;SPAN style="color: #0000ff;"&gt;"FeatureID", "OID@"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit; color: black; line-height: 1.5;"&gt;]&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;

&lt;SPAN style="font-size: 10pt; line-height: 1.5; font-family: arial, helvetica, sans-serif;"&gt;# Intialize T1 as a dictionary&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;T1Dict = {}&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;# Initialize a list to hold any concatenated key duplicates found&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;T1KeyDups = []&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;# Open a search cursor and iterate rows&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;with arcpy.da.SearchCursor(T1, fields) as searchRows:&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;&amp;nbsp; for searchRow in searchRows:&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Build a composite key value from 2 fields&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = '{};{}'.format(searchRow[0], searchRow[1])&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not keyValue in T1Dict:&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Key not in dictionary.&amp;nbsp; Add Key pointing to a list of a list of field values&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1Dict[keyValue] = [&lt;/SPAN&gt;&lt;CODE&gt;list(searchRow[2:])&lt;/CODE&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;]&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Key in dictionary is not unique.&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1KeyDups.append(&lt;/SPAN&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;keyValue&lt;/SPAN&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/SPAN&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt; Append &lt;/SPAN&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;a list of field values &lt;/SPAN&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt;to the list&lt;/SPAN&gt;&lt;SPAN style="color: #222222; line-height: 12pt;"&gt; the Key points to&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="color: #222222; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1Dict[keyValue].append(&lt;/SPAN&gt;&lt;CODE&gt;list(searchRow[2:])&lt;/CODE&gt;&lt;SPAN style="color: #222222; line-height: 1.5;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: #222222; font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 12pt;"&gt;del searchRows, searchRow&lt;/SPAN&gt;

&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;# Sample of how to access the keys, record count, and record values of the dictionary&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;for keyValue in T1Dict.keys():&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; for i in range(0, len(T1Dict[keyValue])):&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "The SiteID;EasyID key is {} with {} record(s).&amp;nbsp; Record {} has FeatureID {} and ObjectID {}.".format(keyValue, len(T1Dict[keyValue]), i+1, T1Dict[keyValue]&lt;I&gt;[0], T1Dict[keyValue]&lt;I&gt;[1])&lt;/I&gt;&lt;/I&gt;&lt;/SPAN&gt;

&lt;SPAN style="line-height: 1.5; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;if len(T1KeyDups) &amp;gt; 0:&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; # Duplicate keys exist in T1&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; # Give a warning and either exit the script or else do a fix of T1 before proceeding&lt;/SPAN&gt;
&lt;SPAN style="line-height: 1.5; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; print("Duplicate keys found!&amp;nbsp; They are:")&lt;/SPAN&gt;
&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: #006699; font-size: 9pt !important;"&gt;&amp;nbsp; for&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt; keyValue &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: #006699; font-size: 9pt !important;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt; &lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 13.3333330154419px;"&gt;T1KeyDups&lt;/SPAN&gt;:&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: #006699; font-size: 9pt !important;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt; i &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: #006699; font-size: 9pt !important;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt; range(&lt;/SPAN&gt;&lt;SPAN class="number" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt;, len(T1Dict[keyValue])):&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: #006699; font-size: 9pt !important;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: blue; font-size: 9pt !important;"&gt;"The SiteID;EasyID key is {} with {} record(s).&amp;nbsp; Record {} has FeatureID {} and ObjectID {}."&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt;.format(keyValue, len(T1Dict[keyValue]), i+&lt;/SPAN&gt;&lt;SPAN class="number" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: green; font-size: 9pt !important;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt;, T1Dict[keyValue]&lt;I&gt;[&lt;/I&gt;&lt;/SPAN&gt;&lt;SPAN class="number" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt;], T1Dict[keyValue]&lt;I&gt;[&lt;/I&gt;&lt;/SPAN&gt;&lt;SPAN class="number" style="font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; color: green; font-size: 9pt !important;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 1.5; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; # Either exit or fix T1 here&lt;/SPAN&gt;
&lt;SPAN style="font-size: 10pt; line-height: 12pt; font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; sys.exit(-1)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:07:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504106#M39590</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T22:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504107#M39591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you are determined to implement the rule as you have describe it here is some code that should work to get a siteID dictionary for T2 that should find the sorted list of integers that are not yet used for each SiteID and assign the next unused number to the Null EasyID records associated with each SiteID.&amp;nbsp; Also, do not bother filtering cursors if you intend to put it in a dictionary. It is faster to put everything into the dictionary and then do all of the logic tests, type validations, and list tracking in code.&amp;nbsp; You might filter for the Null EasyID values prior running the updateCursor, but even if you have 1 million records to process they will take only about 5 minutes for the update cursor to run through all of them (and the SQL that filters for Null values might take longer, since Null values queries run pretty slow, especially if EasyID is not indexed).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;OL class="dp-py" start="1" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #5c5c5c; margin-bottom: 1px !important; margin-left: 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; arcpy&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; sys&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="comment" style="font-weight: inherit; font-style: inherit; color: #008200; font-size: 9pt !important; background-color: inherit;"&gt;#Tables&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;T1 = r&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"C:\Python\Scratch.gdb\Table1"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;T2 = r&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"C:\Python\Scratch.gdb\Table2"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;fields = [&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"SiteID"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"EasyID"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"FeatureID"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"OID@"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;]&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;SPAN style="line-height: 1.5;"&gt;# Get the list of easyIDs associated with each SiteID in a dictionary for T1&lt;/SPAN&gt;
&lt;SPAN style="line-height: 1.5;"&gt;T1SiteIDDict = {}&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5;"&gt;with arcpy.da.SearchCursor(T1, fields) as searchRows:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; searchRow &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; searchRows:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = &lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: blue; font-size: 9pt !important;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; line-height: 1.5; font-size: 9pt !important;"&gt;searchRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; line-height: 1.5; font-size: 9pt !important;"&gt;]&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; keyValue &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; T1Dict:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment" style="font-weight: inherit; font-style: inherit; color: #008200; font-size: 9pt !important; background-color: inherit;"&gt;# Key not in dictionary.&amp;nbsp; Add Key pointing to a list of a list of field values&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1SiteIDDict[keyValue] = [searchRow[1&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;]]&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="comment" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: #008200; font-size: 9pt !important;"&gt;# Append a list of field values to the list the Key points to&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; line-height: 1.5; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1SiteIDDict[keyValue].append(searchRow[&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN style="color: #008000;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: black; font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;])&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;del&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; searchRows, searchRow&lt;/SPAN&gt;&lt;/SPAN&gt;

# Get the list of easyIDs associated with each SiteID in a dictionary for T2
T2SiteIDDict = {}
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit;"&gt;with arcpy.da.SearchCursor(T1, fields) as searchRows:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt; searchRow &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt; searchRows:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = &lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: blue; font-size: 9pt !important;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; line-height: 1.5; font-size: 9pt !important;"&gt;searchRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-style: inherit; font-weight: inherit; line-height: 1.5; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; line-height: 1.5; font-size: 9pt !important;"&gt;]&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt; keyValue &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt; T1Dict:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment" style="font-weight: inherit; font-style: inherit; color: #008200; font-size: 9pt !important;"&gt;# Key not in dictionary.&amp;nbsp; Add Key pointing to a list of a list of field values&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T2SiteIDDict[keyValue] = [searchRow[1&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important;"&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt;]]&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="comment" style="font-style: inherit; font-weight: inherit; color: #008200; font-size: 9pt !important;"&gt;# Append a list of field values to the list the Key points to&lt;/SPAN&gt;&lt;SPAN style="color: black; font-style: inherit; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T2SiteIDDict[keyValue].append(searchRow[&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt;&lt;SPAN style="color: #008000;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: black; font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt;])&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important;"&gt;del&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt; searchRows, searchRow&lt;/SPAN&gt;&lt;/SPAN&gt;

&lt;SPAN style="line-height: 1.5;"&gt;SideIDDict = {}&lt;/SPAN&gt;
&lt;SPAN style="line-height: 1.5;"&gt;for keyValue in T2SiteIDDict.keys():&lt;/SPAN&gt;
&amp;nbsp; intList = []
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp; for easyID in T2SiteIDDict[keyValue]:&lt;/SPAN&gt;
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if easyID.isnumeric():&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # easyID is a number
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if float(easyID) == int(easyID):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # easyID is an integer, so add it to the list
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intList.append(int(easyID))
&amp;nbsp; if keyValue in T1SiteIDDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for easyID in T1SiteIDDict[keyValue]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if easyID.isnumeric():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # easyID is a number
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if float(easyID) == int(easyID):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # easyID is an integer, so add it to the list
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intList.append(int(easyID))
&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; # remove already used numbers out of the numbers from 1 to 9999&lt;/SPAN&gt;
&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; # and get a sorted list stored for each SiteID&lt;/SPAN&gt;
&lt;SPAN class="pln" style="color: #000000;"&gt;&amp;nbsp; SiteIDDict[keyValue] = sorted(set&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;range&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; set(intList))&lt;/SPAN&gt;


&lt;OL class="dp-py" start="1" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #5c5c5c; margin-bottom: 1px !important; margin-left: 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;with arcpy.da.UpdateCursor(T2, fields) as updateRows:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; updateRow &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; updateRows:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if updateRow[1] == None:&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; templist = SiteIDDict[updateRow[0]]&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = templist[0]&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I believe updates of the list affect the list in the dictionary&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; templist.remove(updateRow[1])&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 12pt; color: black; font-style: inherit; font-size: 9pt; background-color: inherit; font-weight: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow) &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:07:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504107#M39591</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T22:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504108#M39592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wow thank you for these excellent resources! I will try to digest this over the weekend, but this looks very promising. Sorry that I didn't provide all of the aspects of this dilemma. I tried to simplify it enough that python masters like yourself wouldn't have to read a novel. As you ascertained, this is complex.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The business table (T1) sits on a 2005 SQL server, unsupported since 10.2. EasyID is a&amp;nbsp; 7 char string used for labeling at a site and it is the syncing bane of my existence. Users are allowed to assign "C5-C8" so that FeatureID represents numerous real world things. C5, C6, C7, and C8 could also exist in T1 individually. It is a data quality mess. To combat this the groupings will not make it to T2. Instead C5, C6, C7, and/or C8 will be digitized by the T2 user, if so desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Luckily, users are unable to delete rows and can't view or change the FeatureID or SiteID. The other table (T2) and a copy of the Sites table are layers in a hosted service for collecting new site features.&amp;nbsp; I update the Sites with a scheduled script and thanks to Collector for ArcGIS 10.3 honoring relationships, all features maintain their SiteID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In short, users are limited to picking an EasyID during feature creation in either table and they could possibly update EasyID on T2. On the off chance they do change EasyID on a feature existing in T1 and T2 there will be a script that joins by FeatureID and updates the one with an earlier edit date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I could go on and on, but don't want to spoil your weekend. Thanks again &lt;A href="https://community.esri.com/migrated-users/4811"&gt;Richard Fairhurst&lt;/A&gt;‌!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:02:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504108#M39592</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2015-02-28T00:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504109#M39593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've made some headway. My script is successfully insertings new rows into sql server with pyodbc. However, I've got an encoding issue when updating the hosted layer. The sql table varchar columns and I assume that hosted layers are nvarchar. The call to update the hosted layer succeeds but the text column doesn't actually update. Integer fields do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code I've kept the actual column names so the SQL Server table fields are:&lt;/P&gt;&lt;P&gt;SiteID--&amp;gt;CustomerID, FeatureID--&amp;gt;PropertyID, and EasyID--&amp;gt; Location&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hosted layer fields are:&lt;/P&gt;&lt;P&gt;SiteID--&amp;gt;CustomerID, FeatureID--&amp;gt;PropertyID_WO, and EasyID--&amp;gt; TAG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've match the sequence to prevent name issues. I'm don't know how to go further without figuring out how to update TAG with Location.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# 


import sys, os, datetime, arcpy, pyodbc, time, uuid


def hms_string(sec_elapsed):
&amp;nbsp;&amp;nbsp;&amp;nbsp; h = int(sec_elapsed / (60 * 60))
&amp;nbsp;&amp;nbsp;&amp;nbsp; m = int((sec_elapsed % (60 * 60)) / 60)
&amp;nbsp;&amp;nbsp;&amp;nbsp; s = sec_elapsed % 60.
&amp;nbsp;&amp;nbsp;&amp;nbsp; return "{}:{:&amp;gt;02}:{:&amp;gt;05.2f}".format(h, m, s)
# End hms_string


def timedif(end_datetime, start_datetime):
&amp;nbsp;&amp;nbsp;&amp;nbsp; seconds_elapsed = (end_datetime - start_datetime).total_seconds()
&amp;nbsp;&amp;nbsp;&amp;nbsp; return hms_string(seconds_elapsed)
# End timedif
start_time = datetime.datetime.now()
print "# Script start: {}".format(start_time)


from arcpy import env, da
from arcrest.security import AGOLTokenSecurityHandler
from arcrest.agol import FeatureService
from arcrest.agol import FeatureLayer
from arcrest.common.filters import LayerDefinitionFilter
from datetime import timedelta


print "# Imports loaded."


# Set Geoprocessing environments
Scratch_gdb = r'C:\Python\scratch.gdb'
arcpy.env.scratchWorkspace = Scratch_gdb
arcpy.env.workspace = Scratch_gdb




Local_Table = r'C:\Users\dkshokes\AppData\Roaming\ESRI\Desktop10.3\ArcCatalog\RTC03.sde\Rainbow.dbo.Property'
Output_Table_1 = "T1"
Expression_1 = r'"CustomerID" = 166602 AND "Location" is not Null'
&lt;SPAN&gt;Online_Trees = r'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgis.com/###/arcgis/rest/services/###/FeatureServer/0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://services.arcgis.com/###/arcgis/rest/services/###/FeatureServer/0&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
username = "####"
password = "####"
proxy_port = None
proxy_url = None
agolSH = AGOLTokenSecurityHandler(username=username, password=password)
Output_Table_2 = "T2"
Expression_2 = '"CustomerID" = 166602'
fields_1 = ['CustomerID', 'Location', 'PropertyID', 'OID@', 'Description', 'CBH', 'PropertyQuantity', 'PropertyItemID', 'DateEntered', 'LastChangeDate', 'Special_Note']
fields_2 = ['CustomerID', 'TAG', 'PropertyID_WO', 'OID@', 'COMMON', 'DBH', 'QTY', 'PropertyItemID', 'CreationDate', 'EditDate', 'Notes', 'Creator', 'Editor', 'PruneYear', 'ProposalStatus', 'SoilYear']
print "\n# Online variables loaded.&amp;nbsp; "


# Local variables:
T1 = Scratch_gdb + "\\" + Output_Table_1
print "# T1 Table: {}".format(T1)
print "# T1 Fields: {}".format(fields_1)
T2 = Scratch_gdb + "\\" + Output_Table_2
print "# T2 Table: {}".format(T2)
print "# T2 Fields: {}".format(fields_2)
FieldMap_1 = r"PropertyID \"PropertyID\" true true false 50 Long 0 10 ,First,#," + Local_Table + ",PropertyID,-1,-1;CustomerID \"CustomerID\" true true false 4 Long 0 10 ,First,#," + Local_Table + ",CustomerID,-1,-1;Location \"Location\" true true false 7 Text 0 0 ,First,#," + Local_Table + ",Location,-1,-1;PropertyItemID \"PropertyItemID\" true true false 4 Long 0 10 ,First,#," + Local_Table + ",PropertyItemID,-1,-1;Description \"Description\" true true false 255 Text 0 0 ,First,#," + Local_Table + ",Description,-1,-1;PropertyQuantity \"PropertyQuantity\" true true false 4 Long 0 10 ,First,#," + Local_Table + ",PropertyQuantity,-1,-1;CBH \"CBH\" true true false 8 Double 1 18 ,First,#," + Local_Table + ",CBH,-1,-1;Special_Note \"Special_Note\" true true false 255 Text 0 0 ,First,#," + Local_Table + ",Special_Note,-1,-1;Status \"Status\" true true false 10 Text 0 0 ,First,#," + Local_Table + ",Status,-1,-1;DateEntered \"DateEntered\" true true false 36 Date 0 0 ,First,#," + Local_Table + ",DateEntered,-1,-1;PropertyGroup \"PropertyGroup\" true true false 2 Short 0 1 ,First,#," + Local_Table + ",PropertyGroup,-1,-1;Removed \"Removed\" true true false 2 Short 0 1 ,First,#," + Local_Table + ",Removed,-1,-1;LastChangeDate \"LastChangeDate\" true true false 36 Date 0 0 ,First,#," + Local_Table + ",LastChangeDate,-1,-1"


if arcpy.Exists(T1):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(T1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Previous T1 Found so it was deleted."
if arcpy.Exists(T2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(T2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Previous T2 Found so it was deleted."


#print "\n# Local variables loaded...Making temporary business table."
arcpy.TableToTable_conversion(Local_Table, Scratch_gdb, Output_Table_1, Expression_1, FieldMap_1, "")
#print "# Successfully made temporary business table."


#print "\n# Querying Feature Layer and Making Temporary Feature Class."
fl = FeatureLayer(Online_Trees, securityHandler=agolSH, initialize=False,proxy_url=proxy_url, proxy_port=proxy_port)
print fl.query(where=Expression_2, out_fields='*', returnGeometry=True, returnIDsOnly=False, returnCountOnly=False, returnFeatureClass=True, out_fc=Output_Table_2)
print "\n# Ready to compare." + "&amp;nbsp; Time elapsed: {}".format(timedif(datetime.datetime.now(), start_time))


print "\n# Intialize T1 as a concatenated dictionary"
T1Dict = {}
# Initialize a list to hold any concatenated key duplicates found
T1KeyDups = []
# Open a search cursor and iterate rows
with arcpy.da.SearchCursor(T1, fields_1) as searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for searchRow in searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Build a composite key value from 2 fields: CustomerID;TAG
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = '{};{}'.format(searchRow[0], searchRow[1]).decode('utf-8')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not keyValue in T1Dict and searchRow[1] is not None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Key not in dictionary.&amp;nbsp; Add Key pointing to a list of a list of field values
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1Dict[keyValue] = [list(searchRow[0:])]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print "T1Dict keyValue: {}".format(keyValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif searchRow[1] is not None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Key in dictionary.&amp;nbsp; Append a list of field values to the list the Key points to
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1KeyDups.append(keyValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1Dict[keyValue].append(list(searchRow[0:]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print T1Dict[keyValue][0:]
del searchRows, searchRow


##print "\n# Sample of how to access the keys, record count, and record values of the dictionary"
##for keyValue in T1Dict.keys():
##&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in range(0, len(T1Dict[keyValue])):
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "T1Dict Key CustomerID;TAG is {} Record:{} of {} PropertyID_WO:{} ObjectID:{}.".format(keyValue, i+1, len(T1Dict[keyValue]), T1Dict[keyValue]&lt;I&gt;[0], T1Dict[keyValue]&lt;I&gt;[1])&lt;/I&gt;&lt;/I&gt;


if len(T1KeyDups) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "T1KeyDups keys found! {}".format(T1KeyDups)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # fix T1 here
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("No Duplicates!")
print "\n# T1Dict Complete:" + "&amp;nbsp; Time elapsed: {}".format(timedif(datetime.datetime.now(), start_time))


print "\n# Get the list of TAGs associated with each CustomerID in a dictionary for T1"
T1CustomerIDDict = {}
with arcpy.da.SearchCursor(T1, fields_1) as searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for searchRow in searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = searchRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not keyValue in T1CustomerIDDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Key not in dictionary.&amp;nbsp; Add Key pointing to a list of a list of field values
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1CustomerIDDict[keyValue] = [searchRow[0:]]&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; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Append a list of field values to the list the Key points to
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T1CustomerIDDict[keyValue].append(searchRow[0:])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print T1CustomerIDDict[keyValue]
del searchRows, searchRow
print "\n# T1CustomerIDDict Complete"


print "\n# Get the list of TAGs associated with each CustomerID in a dictionary for T2"
T2CustomerIDDict = {}
with arcpy.da.SearchCursor(T2, fields_2) as searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for searchRow in searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = searchRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not keyValue in T2CustomerIDDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T2CustomerIDDict[keyValue] = [searchRow[0:]]
&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; T2CustomerIDDict[keyValue].append(searchRow[0:])
del searchRows, searchRow
print "\n# T2CustomerIDDict Complete"


print "\n# Creating CustomerIDDict"
CustomerIDDict = {}
for keyValue in T2CustomerIDDict.keys():
&amp;nbsp;&amp;nbsp;&amp;nbsp; intList = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for TAG in T2CustomerIDDict[keyValue]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if TAG[1]:
&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; TAG = int(TAG[1])
&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; intList.append(TAG)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Error with T2.TAG"
&amp;nbsp;&amp;nbsp;&amp;nbsp; if keyValue in T1CustomerIDDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for TAG in T1CustomerIDDict[keyValue]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&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; if TAG[1]:
&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; TAG = int(TAG[1])
&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; intList.append(TAG)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&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; print "Error with T1.TAG"&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 "\nnumeric T2.TAGs: {}".format(set(intList))
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print "\nnumeric T1.TAGs: {}".format(set(intList))
&amp;nbsp;&amp;nbsp;&amp;nbsp; # remove already used numbers out of the numbers from 1 to 9999
&amp;nbsp;&amp;nbsp;&amp;nbsp; # and get a sorted list for use with an update cursor.
&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerIDDict[keyValue] = sorted(set(range(1, 200)) - set(intList))
print "\n# CustomerIDDict Complete"


print "\n# Inserting and Updating" + "&amp;nbsp; Time elapsed: {}".format(timedif(datetime.datetime.now(), start_time))
### This cursor sucessfully inserts into sql server a new row with an unused TAG and attributes from the hosted feature.
### It then updates the hosted layer fields propertyID_WO and TAG. 
##&amp;nbsp; propertyID_WO succeeds but TAG is blank
#
print "#&amp;nbsp; Working with pyodbc sql stuff"
cnxn_SQL = pyodbc.connect(Trusted_Connection='yes', Driver = '{SQL Server Native Client 10.0}', Server = '###', database = '###')
cursor_SQL = cnxn_SQL.cursor() 
with arcpy.da.UpdateCursor(T2, fields_2) as updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:&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; # if T2.Row has TAG and CustomerID but no PropertyID compare and look for match in T1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (updateRow[2] == None) and not (updateRow[1] == None):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "1st if TAG {} PropertID {}".format(updateRow[1],updateRow[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for valu in T1CustomerIDDict[updateRow[0]]:
&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; if valu[1] == updateRow[1]:
&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; try:
&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; updateRow[2] = valu[2]
&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; print "# Updating PropertyID_WO for TAG:{} hosted layer with {}".format(updateRow[1],updateRow[2])
&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; fl.calculate(where="OBJECTID={} AND CustomerID={} AND TAG={}".format(updateRow[3], updateRow[0], updateRow[1]), calcExpression={"field" : "PropertyID_WO", "value" : "{}".format(updateRow[2])})
&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; print "# Success"
&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; except:
&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; print "# Failed Hosted Update of PropertyID"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (updateRow[1] == None) and (updateRow[2] == None):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "3rd if TAG {} PropertID {}".format(updateRow[1],updateRow[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newPropID = None
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print CustomerIDDict[updateRow[0]][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set templist to show available integer TAGs for 1 CustomerID at a time.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; templist = CustomerIDDict[updateRow[0]]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set Null tag to first available integer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print updateRow[1:3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = templist[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Insert to local sql server table, update online from sql results, then Remove used tag.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print updateRow[1:3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&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; # Get ItemID required by insert trigger
&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; propitemid = cursor_SQL.execute("SELECT [PropertyItemID] from [TREESPECIESRELATIONSHIPTABLE] Where [COMMON__GIS_name_] = ?",updateRow[4]).fetchone()[0]
&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; # Insert New trees into T1
&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; cursor_SQL.execute("IF NOT EXISTS (SELECT 1 FROM Property WHERE CustomerID = ? and Location = ?) INSERT INTO Property(CustomerID, Location, Description, CBH, PropertyQuantity, PropertyItemID, DateEntered, LastChangeDate, Special_Note) values (?,?,?,?,?,?,?,?,?)", updateRow[0], updateRow[0], updateRow[0],updateRow[1],updateRow[4],updateRow[5],updateRow[6],propitemid,updateRow[8],updateRow[9],updateRow[10])
&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; cnxn_SQL.commit()
&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; # Grab to primary key for updating hosted layer
&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; newPropID = cursor_SQL.execute("Select PropertyID From Property where CustomerID=? AND Location=?", updateRow[0], updateRow[1]).fetchone()[0]
&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; print "Finished Insert for New PropertyID {}".format(newPropID)
&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; cnxn_SQL.commit()
&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; updateRow[2] = newPropID
&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; templist.remove(updateRow[1])
&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; print updateRow[1:3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&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; print "# Failed SQL Server Insert"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&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; print "# Updating TAG and PropertyID_WO for hosted layer"
&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; print fl.calculate(where="OBJECTID={} AND CustomerID={}".format(updateRow[3], updateRow[0]), calcExpression={"field" : "TAG", "value" : "{}".format(updateRow[1]),"field" : "PropertyID_WO", "value" : "{}".format(updateRow[2])})
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&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; print "# Failed Hosted Update of TAG and PropertyID"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)
del updateRows, updateRow
cnxn_SQL.close()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
#
##
###
###
print "Finished!" + "&amp;nbsp; Time elapsed: {}".format(timedif(datetime.datetime.now(), start_time))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:07:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504109#M39593</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2021-12-11T22:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504110#M39594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not clear which part of the code is causing the problem and which field name is for an integer and which is for a string.&amp;nbsp; Generally to use Python to write to a string field you have to enclose non-strings in the str() method.&amp;nbsp; For converting strings to integers you must always test that the string is actually an integer and use Null (or some other default value for blank numbers) when the strings is not numeric.&amp;nbsp; For example, " " is not an integer and will fail if you try to convert it to an integer.&amp;nbsp; Potentially Null will also cause a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, any time type conversion is involved in a script it is easy to produce errors and unexpected results until you include enough logic to handle both the values that can convert and the values that can't convert at each conversion step.&amp;nbsp; To confirm for yourself what is failing you should include a print statement in your try except block to show you the actual value read from the source field that you are trying to write to the field that is rejecting the value or producing bad results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 17:18:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504110#M39594</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-03-03T17:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504111#M39595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The last try at line 230 is where it is succeeding the REST call, but the layer's field values stay null. A few lines prior, updateRow[1] gets an integer from the dictionary CustomerIDDict.&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;&lt;SPAN class="comment" style="font-weight: inherit; font-style: inherit; color: #008200; font-size: 9pt !important;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #008200; font-size: 12px;"&gt;# Set Null tag to first available integer&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;] = templist[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;]&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then updateRow[1] gets put into...&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&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; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; fl.calculate(where=&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"OBJECTID={} AND CustomerID={}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;], updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;]), calcExpression={&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"field"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; : &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"TAG"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"value"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; : &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;]),&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"field"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; : &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"PropertyID_WO"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"value"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; : &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; color: green; font-size: 9pt !important; background-color: inherit;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;])})&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: inherit; color: black; font-weight: inherit; font-size: 9pt !important; font-style: inherit;"&gt;I'm guessing it turns into: &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; font-size: 9pt !important;"&gt;calcExpression={&lt;/SPAN&gt;&lt;SPAN class="string" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; color: blue; font-size: 9pt !important;"&gt;"field"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; font-size: 9pt !important;"&gt; : &lt;/SPAN&gt;&lt;SPAN class="string" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; color: blue; font-size: 9pt !important;"&gt;"TAG"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; font-size: 9pt !important;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; color: blue; font-size: 9pt !important;"&gt;"value"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; font-size: 9pt !important;"&gt; : &lt;/SPAN&gt;&lt;SPAN class="string" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit; font-weight: inherit; color: blue; font-size: 9pt !important;"&gt;"4",....}&lt;SPAN style="color: #000000; font-size: 12px;"&gt;,but I'm not certain.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: inherit; color: black; font-weight: inherit; font-size: 9pt !important; font-style: inherit;"&gt;Also, at line&amp;nbsp; 97 added a decode and a typeerror went away. I can't tell if this decode causes issues in the dictionary later on though.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment" style="font-weight: inherit; font-style: inherit; color: #008200; font-size: 9pt !important; background-color: inherit;"&gt;# Build a composite key value from 2 fields: CustomerID;TAG&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;'{};{}'.format(searchRow[0], searchRow[1]).decode('utf-8'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 18:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504111#M39595</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2015-03-03T18:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504112#M39596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, line 230 is a print statement.&amp;nbsp; Are you sure it is executing?&amp;nbsp; You should break that whole expression down to multiple prints statements so you are certain exactly what arguments are being passed to the query and calculation.&amp;nbsp; For example, you could try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"OBJECTID={} AND CustomerID={}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;], updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;print &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 9pt !important; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;print &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 9pt !important; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;Then, if all of those inputs makes sense, execute the &lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;fl.calculate outside of a print operation.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 12px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;There are some details to pay attention to.&amp;nbsp; If CustomerID is numeric and the value makes sense, then the SQL should be fine.&amp;nbsp; But if CustomerID is a string value then the SQL should fail, since the value is not within quotes.&amp;nbsp; For a string CustomerID you would need:&amp;nbsp; &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"OBJECTID={} AND CustomerID='{}'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 9pt !important; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-style: inherit;"&gt;&lt;SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: blue; font-size: 9pt !important;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;.format(updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;], updateRow[&lt;/SPAN&gt;&lt;SPAN class="number" style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: green; font-size: 9pt !important;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000; font-size: 9pt !important;"&gt;])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 19:32:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504112#M39596</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-03-03T19:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Updating 2 tables related by 3 ID fields</title>
      <link>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504113#M39597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it out. I was trying to update 2 different fields at once and field calculator understandably only takes one. Its crazy how much time I looked up information on unicode stuff only to find it was a misuse of the parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can't thank you enough Richard. I should be able to fumble through the rest of the conditionals.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 22:36:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-2-tables-related-by-3-id-fields/m-p/504113#M39597</guid>
      <dc:creator>DavinShokes1</dc:creator>
      <dc:date>2015-03-03T22:36:07Z</dc:date>
    </item>
  </channel>
</rss>

