<?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: Problem using .sde featureclass in the GetCount tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35335#M2755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the suggestion, MZ. Unfortunately, that didn't work either. On the bright side, with some help from my database administrator, I found out the path which &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;does&lt;/SPAN&gt;&lt;SPAN&gt; work. It turns out to be: 'Database Connections\Connection to gisviewer.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcels_area'. All I have to do now is to extract the 'gisviewer' string (or whichever connection was used) from the string DataSource provides.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Mar 2013 20:30:18 GMT</pubDate>
    <dc:creator>AultonSmith1</dc:creator>
    <dc:date>2013-03-20T20:30:18Z</dc:date>
    <item>
      <title>Problem using .sde featureclass in the GetCount tool</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35333#M2753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My app needs to test the user-selected feature class for a selected set before it continues. The only method I have found in the forum to accomplish this is to use the GetCount function on the map layer and on the source feature class and compare them. So far, so good, this works fine on shapefiles. But I need for it to work on .sde feature classes, too. The documentation and posts in the forum suggest using the arcpy.mapping.layer.DataSource function to get the connection to the .sde feature class. This is not working for me. Any help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the path which is returned by the DataSource function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; lyr = arcpy.mapping.Layer(r"New Group Layer\Property Line")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; str = lyr.dataSource&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print str&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Documents and Settings\acsmith\Application Data\ESRI\ArcCatalog\gisviewer@sde.pepopcogis2.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcel_area&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(gisviewer is the connection name, pepopcogis2 is the server, SDE.SDE.cadastre_real_estate is the dataset, and SDE.SDE.parcel_area is the feature class)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the error which is returned by the failed GetCount function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; count1 = arcpy.GetCount_management(arcpy.mapping.Layer(r"New Group Layer\Property Line").dataSource)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error Traceback (most recent call last): File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 13637, in GetCount raise e ExecuteError: ERROR 000732: Input Rows: Dataset C:\Documents and Settings\acsmith\Application Data\ESRI\ArcCatalog\gisviewer@sde.pepopcogis2.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcel_area does not exist or is not supported&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 19:26:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35333#M2753</guid>
      <dc:creator>AultonSmith1</dc:creator>
      <dc:date>2013-03-20T19:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using .sde featureclass in the GetCount tool</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35334#M2754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you access it directly without using a layer? Try these two.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = r'C:\Documents and Settings\acsmith\Application Data\ESRI\ArcCatalog\gisviewer@sde.pepopcogis2.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcel_area'

print(arcpy.Exists(fc))

print(int(arcpy.GetCount_management(fc).getOutput(0)))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also you may want to investigate FIDSet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Layer_properties/018v00000063000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/Layer_properties/018v00000063000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35334#M2754</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-10T21:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using .sde featureclass in the GetCount tool</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35335#M2755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the suggestion, MZ. Unfortunately, that didn't work either. On the bright side, with some help from my database administrator, I found out the path which &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;does&lt;/SPAN&gt;&lt;SPAN&gt; work. It turns out to be: 'Database Connections\Connection to gisviewer.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcels_area'. All I have to do now is to extract the 'gisviewer' string (or whichever connection was used) from the string DataSource provides.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 20:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-sde-featureclass-in-the-getcount/m-p/35335#M2755</guid>
      <dc:creator>AultonSmith1</dc:creator>
      <dc:date>2013-03-20T20:30:18Z</dc:date>
    </item>
  </channel>
</rss>

