<?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: Python API to update attributes on feature layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-api-to-update-attributes-on-feature-layer/m-p/1318330#M68396</link>
    <description>&lt;P&gt;Oh.&amp;nbsp; the updates parameter is supposed to be a list in edit_features() method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;edit_result = layer.edit_features(updates=[editFeature])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2023 14:14:49 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2023-08-14T14:14:49Z</dc:date>
    <item>
      <title>Python API to update attributes on feature layer</title>
      <link>https://community.esri.com/t5/python-questions/python-api-to-update-attributes-on-feature-layer/m-p/1318327#M68395</link>
      <description>&lt;P&gt;This is supposed to be simple but running into issues attempting to submit updates to a feature service layer.&amp;nbsp; Forever I have simply used the REST api (ie. "applyEdits") on a service layer and always works as expected but now I'm converting some of that code over to the python API to work directly on the portal items themselves.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, this is somewhat close to &lt;A href="https://developers.arcgis.com/python/guide/editing-features/" target="_self"&gt;THIS&lt;/A&gt; example but getting this error "&lt;SPAN&gt;&lt;EM&gt;object&amp;nbsp;of&amp;nbsp;type&amp;nbsp;'Feature'&amp;nbsp;has no len()&lt;/EM&gt;"&amp;nbsp;&lt;/SPAN&gt;on the edit_features() method.&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#set layer
portalItem = gis.content.get('9cb6469e3d3e43379551abbb1b74a284')
for layer in portalItem.layers:
    if "Final" in layer.properties.name:
        #check if there is a matching appId
        checkSet = layer.query(where='objectid={}'.format(oid), return_count_only=True)
        if checkSet == 1:
            #get the row to edit using the oid value
            fset = layer.query(where='objectid={}'.format(oid))
            editFeature = [f for f in fset.features if f.attributes['OBJECTID']==oid][0]
            editFeature.attributes['PERMIT_ID'] = inputPermitId
            editFeature.attributes['PERMIT_NO'] = inputPermitId
            edit_result = layer.edit_features(updates=editFeature)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 14:13:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-api-to-update-attributes-on-feature-layer/m-p/1318327#M68395</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2023-08-14T14:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python API to update attributes on feature layer</title>
      <link>https://community.esri.com/t5/python-questions/python-api-to-update-attributes-on-feature-layer/m-p/1318330#M68396</link>
      <description>&lt;P&gt;Oh.&amp;nbsp; the updates parameter is supposed to be a list in edit_features() method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;edit_result = layer.edit_features(updates=[editFeature])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 14:14:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-api-to-update-attributes-on-feature-layer/m-p/1318330#M68396</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2023-08-14T14:14:49Z</dc:date>
    </item>
  </channel>
</rss>

