<?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: How do you compare a list of records in a table with a list of feature classes, populating the table with the feature class records counts? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468899#M36606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They have similar characters, but the names in the table are spelled out for the most part where the feature class names are conjunctions. Here is the list of the feature class names.&lt;/P&gt;&lt;P&gt;swPipeEnd&lt;BR /&gt;swStream&lt;BR /&gt;swSplwy&lt;BR /&gt;swOutCtrlStr&lt;BR /&gt;swOpnCnd&lt;BR /&gt;swManhole&lt;BR /&gt;swJunctBox&lt;BR /&gt;swIntersection&lt;BR /&gt;swInlet&lt;BR /&gt;swHeadwall&lt;BR /&gt;swClsdCnd&lt;BR /&gt;swBridge&lt;BR /&gt;swAssumedStructure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Sep 2019 18:41:05 GMT</pubDate>
    <dc:creator>RPGIS</dc:creator>
    <dc:date>2019-09-26T18:41:05Z</dc:date>
    <item>
      <title>How do you compare a list of records in a table with a list of feature classes, populating the table with the feature class records counts?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468897#M36604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have a relatively simple script that is basically a complete list of feature classes in a database and I was wondering how you would compare that list of feature classes to the list of records in a table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other thing is, if there is a match between the list of feature classes and the table, to have the table populate with the record count of the matching feature class. I have a rough script that has both the list of the feature classes in a database and the list from the table, as well as the counts for each feature class. The other issue is that the names aren't the exact same but are similar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am trying to first figure out how to compare the list of feature classes to the list of records in the table. I think once I can get that then the rest should be relatively simple to do.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;#set parameters&lt;/SPAN&gt;
inputTable &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'G:\MyThings\Test\NewTest3\StormLoad.gdb\Stormload_Table'&lt;/SPAN&gt;&lt;SPAN class="comment token"&gt;#arcpy.GetParameterAsText(0)&lt;/SPAN&gt;
select_databases &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'G:\MyThings\Test\NewTest4\StormLoad.gdb'&lt;/SPAN&gt;&lt;SPAN class="comment token"&gt;#arcpy.GetParamterAsText(1)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#select_fields_toUpdate = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;
input_value &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2'&lt;/SPAN&gt;&lt;SPAN class="comment token"&gt;#arcpy.GetParameterAsText(3)&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; select_databases

&lt;SPAN class="comment token"&gt;#Get list of field names&lt;/SPAN&gt;
field_names &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inputTable&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Identify feature class and database field name&lt;/SPAN&gt;
fcdb_name_field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; field_names&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Select the field names to populate&lt;/SPAN&gt;
select_field_names &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; field_names&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    
datasetList &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDatasets&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'*'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Feature'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#List feature classes&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;fcsInDS&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; dataset &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; datasetList&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dataset
        fcList &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; fcList

fcsInDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

fcs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fcsInDS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fcsInDB
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    fc_ReCount &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'{0} has a record count of {1}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fc_ReCount&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 

    &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inputTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field_names&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fc&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; input_value &lt;SPAN class="comment token"&gt;#&lt;/SPAN&gt;
                cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG __jive_id="460536" alt="" class="image-1 jive-image j-img-original" src="/legacyfs/online/460536_table records 2.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also noticed that when it loops through the list of combined lists, that it errors out with the feature classes in the database as either non existent or supported.&amp;nbsp;I tried making a couple of adjustments to this script but it returns errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would greatly appreciate any assistance with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:47:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468897#M36604</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-12-11T20:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you compare a list of records in a table with a list of feature classes, populating the table with the feature class records counts?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468898#M36605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;The other issue is that the names aren't the exact same but are similar.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This issue will be the hardest one to overcome, as you have already guessed.&amp;nbsp; Can you elaborate on how they are similar or different?&amp;nbsp; Some examples would also be helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2019 17:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468898#M36605</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-09-26T17:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do you compare a list of records in a table with a list of feature classes, populating the table with the feature class records counts?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468899#M36606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They have similar characters, but the names in the table are spelled out for the most part where the feature class names are conjunctions. Here is the list of the feature class names.&lt;/P&gt;&lt;P&gt;swPipeEnd&lt;BR /&gt;swStream&lt;BR /&gt;swSplwy&lt;BR /&gt;swOutCtrlStr&lt;BR /&gt;swOpnCnd&lt;BR /&gt;swManhole&lt;BR /&gt;swJunctBox&lt;BR /&gt;swIntersection&lt;BR /&gt;swInlet&lt;BR /&gt;swHeadwall&lt;BR /&gt;swClsdCnd&lt;BR /&gt;swBridge&lt;BR /&gt;swAssumedStructure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2019 18:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468899#M36606</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-09-26T18:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do you compare a list of records in a table with a list of feature classes, populating the table with the feature class records counts?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468900#M36607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I could probably change the names of the feature classes in the table. I thought about working on a script that would pull out only the names of the needed feature classes. The issue I ran into is how to set up the output parameters so that the user could simple select from the list rather than having it scripted. I don't quite know how to set that up, but I am familiar with the set parameter and/or the set parameter as text options. I may look into that further after I manage to get this script up and running.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2019 18:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-compare-a-list-of-records-in-a-table/m-p/468900#M36607</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-09-26T18:47:09Z</dc:date>
    </item>
  </channel>
</rss>

