<?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 count records in hosted feature layer with Python in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1389322#M1344</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7474"&gt;@JoseSanchez&lt;/a&gt;, might be late response, but I hope, this answers your question:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "username", "password")

# Access your feature layer
item = gis.content.get("&amp;lt;ITEM ID&amp;gt;")
layer = item.layers[0]  
result = layer.query(return_count_only=True)

# Print the count of features
print("Number of features:", result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GeeteshSingh07_0-1709277506470.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/96432i1FFDD68C58225AA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GeeteshSingh07_0-1709277506470.png" alt="GeeteshSingh07_0-1709277506470.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Mar 2024 07:18:44 GMT</pubDate>
    <dc:creator>GeeteshSingh07</dc:creator>
    <dc:date>2024-03-01T07:18:44Z</dc:date>
    <item>
      <title>How to count records in hosted feature layer with Python</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1359510#M1311</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Is there a way to count records from a hosted feature class in AGOL using Python?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 02:20:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1359510#M1311</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2023-12-12T02:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to count records in hosted feature layer with Python</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1389322#M1344</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7474"&gt;@JoseSanchez&lt;/a&gt;, might be late response, but I hope, this answers your question:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "username", "password")

# Access your feature layer
item = gis.content.get("&amp;lt;ITEM ID&amp;gt;")
layer = item.layers[0]  
result = layer.query(return_count_only=True)

# Print the count of features
print("Number of features:", result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GeeteshSingh07_0-1709277506470.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/96432i1FFDD68C58225AA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GeeteshSingh07_0-1709277506470.png" alt="GeeteshSingh07_0-1709277506470.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 07:18:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1389322#M1344</guid>
      <dc:creator>GeeteshSingh07</dc:creator>
      <dc:date>2024-03-01T07:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to count records in hosted feature layer with Python</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1389393#M1345</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/721900"&gt;@GeeteshSingh07&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is&amp;nbsp; how I did&amp;nbsp; it:&lt;/P&gt;&lt;P&gt;# Get FeatureLayerCollection&lt;BR /&gt;myCollection= signInObject.GIS.content.get('#######')&lt;/P&gt;&lt;P&gt;# Obtain feature layer from FeatureLayerCollection&lt;BR /&gt;featureLayer = myCollection.layers[0]&lt;BR /&gt;# Query a Feature Layer to get a Feature Set&lt;BR /&gt;feature_set = featureLayer.query(where="1=1")&lt;BR /&gt;# Assign a variable to the list of features in the Feature Set&lt;BR /&gt;feature_list = feature_set.features&lt;BR /&gt;# Count records&lt;BR /&gt;print(len(feature_list))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 13:16:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/how-to-count-records-in-hosted-feature-layer-with/m-p/1389393#M1345</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2024-03-01T13:16:48Z</dc:date>
    </item>
  </channel>
</rss>

