<?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: Updating feature attributes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-feature-attributes/m-p/1264298#M80462</link>
    <description>&lt;P&gt;Ahh figured it out, I had a silly typo in code, for those interested do this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.on("edits", (e) =&amp;gt; {
const emptyFeature = e.edits?.addFeatures?.filter((e: any) =&amp;gt; e.attributes.weight === null);

if(emptyFeature?.length) {
// features without weight attribute
// default weight is 1000
emptyFeature.forEach((e) =&amp;gt; {
//update feature's weight attribute to 1000
e.attributes.weight = 1000;

layer.applyEdits({updateFeatures: [e]}).then((e) =&amp;gt;{
// do something with success result
}).catch((err) =&amp;gt; {
// do something with err result
});
});
}
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 05 Mar 2023 00:52:10 GMT</pubDate>
    <dc:creator>Aeseir</dc:creator>
    <dc:date>2023-03-05T00:52:10Z</dc:date>
    <item>
      <title>Updating feature attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-feature-attributes/m-p/1264297#M80461</link>
      <description>&lt;P&gt;I am trying to figure out how I can update a feature's attributes during edit event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the code so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// layer is of type FeatureLayer
layer.on("edits", (e) =&amp;gt; {
const emptyFeature = e.edits?.addFeatures?.filter((e: any) =&amp;gt; e.attributes.weight === null);

if(emptyFeature?.length) {
// features without weight attribute
// default weight is 1000
emptyFeature.forEach((e) =&amp;gt; {
//update feature's weight attribute to 1000
}
);
}
}
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling to find the right combination to update these empty features any advice is appreciated.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2023 00:38:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-feature-attributes/m-p/1264297#M80461</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2023-03-05T00:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Updating feature attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-feature-attributes/m-p/1264298#M80462</link>
      <description>&lt;P&gt;Ahh figured it out, I had a silly typo in code, for those interested do this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.on("edits", (e) =&amp;gt; {
const emptyFeature = e.edits?.addFeatures?.filter((e: any) =&amp;gt; e.attributes.weight === null);

if(emptyFeature?.length) {
// features without weight attribute
// default weight is 1000
emptyFeature.forEach((e) =&amp;gt; {
//update feature's weight attribute to 1000
e.attributes.weight = 1000;

layer.applyEdits({updateFeatures: [e]}).then((e) =&amp;gt;{
// do something with success result
}).catch((err) =&amp;gt; {
// do something with err result
});
});
}
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2023 00:52:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-feature-attributes/m-p/1264298#M80462</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2023-03-05T00:52:10Z</dc:date>
    </item>
  </channel>
</rss>

