<?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: Update feature attribute after adding to feature layer in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724058#M16103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Andreas Ruloffs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you want to add only one value, maybe the easiest solution could be working with templates.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, there is one value I want to add programmatically, it is user id, which is generated depending on date and time. I'm new in API for Flex. What are templates and how can I use them to achieve this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrzej Mi�?osz&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Mar 2014 15:40:40 GMT</pubDate>
    <dc:creator>AndrzejMilosz</dc:creator>
    <dc:date>2014-03-07T15:40:40Z</dc:date>
    <item>
      <title>Update feature attribute after adding to feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724056#M16101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my editing application I use &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;esri:Editor&lt;/SPAN&gt;&lt;SPAN&gt;. I want to do next thing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On creating new feature all attributes values except one should be added by user, the one should be added programmatically after feature created. I do not know what is the right way to added attribute value programatically.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I should call the method after FeatureLayer &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;editsComplete&lt;/SPAN&gt;&lt;SPAN&gt; and do &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;applyEdits&lt;/SPAN&gt;&lt;SPAN&gt; to update newly created feature. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know the correct way to access the created feature. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My part of code is below, but the method &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;trasy_editsCompleteHandler(event)&lt;/SPAN&gt;&lt;SPAN&gt; is not called:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FeatureLaye definition:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;esri:FeatureLayer id="trasy"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; editsComplete="trasy_editsCompleteHandler(event)"
&amp;nbsp;&amp;nbsp; mode="snapshot"
&amp;nbsp;&amp;nbsp; outFields="[Miesiace, Jak_czesto, Kierunek, Ile_minut, Poczatek, Koniec]"
&amp;nbsp;&amp;nbsp; url="http://149.156.80.249:6080/arcgis/rest/services/daneRowerowe/trasy_miejsca_Krakow/FeatureServer/3"/&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private var username:String = "newuser";
protected function trasy_editsCompleteHandler(event:FeatureLayerEvent):void
{
 const trasaUz:Object = {};
 trasaUz["Uzytkownik"] = username;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var fSet:FeatureSet = new FeatureSet(event.adds);
 fSet.features[0].attributes = trasaUz;
 trasy.applyEdits(null, [fSet.features[0]], null);&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrzej&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 20:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724056#M16101</guid>
      <dc:creator>AndrzejMilosz</dc:creator>
      <dc:date>2014-03-05T20:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update feature attribute after adding to feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724057#M16102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you can use a &lt;/SPAN&gt;&lt;STRONG&gt;FeatureLayerEvent.EDITS_STARTING&lt;/STRONG&gt;&lt;SPAN&gt; event. This event is thrown before the edit is made permanently.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So you can manipulate the features before they are written in the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to add only one value, maybe the easiest solution could be working with templates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andreas Ruloffs&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private function beforeEdit(event:FeatureLayerEvent):void
{
 // here you can manipulate the features you want to.
 event.featureLayer.applyEdits(event.adds,event.updates, event.deletes);
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:58:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724057#M16102</guid>
      <dc:creator>AndreasRuloffs1</dc:creator>
      <dc:date>2021-12-12T06:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Update feature attribute after adding to feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724058#M16103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Andreas Ruloffs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you want to add only one value, maybe the easiest solution could be working with templates.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, there is one value I want to add programmatically, it is user id, which is generated depending on date and time. I'm new in API for Flex. What are templates and how can I use them to achieve this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrzej Mi�?osz&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 15:40:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/update-feature-attribute-after-adding-to-feature/m-p/724058#M16103</guid>
      <dc:creator>AndrzejMilosz</dc:creator>
      <dc:date>2014-03-07T15:40:40Z</dc:date>
    </item>
  </channel>
</rss>

