<?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 to test feature class for existence of records in a 2nd feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525553#M41166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;does something like this make sense?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for each record in table1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if table1.record.field1.value somewhere in table2.field1 and table1.record.field2.value = table2.field2 (for that matching record)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; skip doing anything on this row&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; append table1.row to table2&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 May 2014 04:22:38 GMT</pubDate>
    <dc:creator>SC1</dc:creator>
    <dc:date>2014-05-14T04:22:38Z</dc:date>
    <item>
      <title>How to test feature class for existence of records in a 2nd feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525552#M41165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think this should have been easy, but I have spent all day racking my brains...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 2 feature classes (points). One comes in daily let's say. The other is a accumulation of all the dailies that come in. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to test if the daily FC has any records that are already present in the cumulative FC, and ignore those when appending or copying into the cumulative FC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried nesting cursors but that doesn't seem to work.... they both have a unique ID field, but at some stage I will want to add another condition that the ID and operator fields must be unique combined (the same ID can have more than one operator).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am so lost.... any help appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 03:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525552#M41165</guid>
      <dc:creator>SC1</dc:creator>
      <dc:date>2014-05-14T03:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to test feature class for existence of records in a 2nd feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525553#M41166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;does something like this make sense?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for each record in table1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if table1.record.field1.value somewhere in table2.field1 and table1.record.field2.value = table2.field2 (for that matching record)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; skip doing anything on this row&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; append table1.row to table2&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 04:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525553#M41166</guid>
      <dc:creator>SC1</dc:creator>
      <dc:date>2014-05-14T04:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to test feature class for existence of records in a 2nd feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525554#M41167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are your test variables unique identifiers?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would think that the logic should go something like this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Open search cursors on both Fcs. Perhaps load the relevant data into 2 dictionaries or something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Run Daily Fc against All Fc and do your test.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you get a match, construct a list of identifiers in Daily Fc that do match (perhaps using the OID).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you need to switch this to the ones that don't match.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A technique I have used in the past (picked up from the very clever people on this forum) is to use sets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Like :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
IDsMissing = list(set(list of all IDs in Daily Fc).difference(set(list of found match IDs)))
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This give you a list of the IDs which don't match.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use this to make a feature layer using a select statement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Copy this feature layer to a temp Fc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Append this into All Fc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Neil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-test-feature-class-for-existence-of-records/m-p/525554#M41167</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2021-12-11T22:54:05Z</dc:date>
    </item>
  </channel>
</rss>

