<?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: adding a graphic to a featurelayer in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659737#M14739</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That got me started.&amp;nbsp; I added this code to my application and I'm obviously missing an array, I get the very last field in my database assigned to my graphic.&amp;nbsp; However, after inserting this code myGraphic no longer gets added as a point to my featureLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var ld:LayerDetails=myFeatureLayer.layerDetails;
var field:Field;
for each (field in ld.fields)
{
 myGraphic.attributes=field.name;
}
myFeatureLayer.applyEdits([myGraphic], null, null);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure I'm approaching this right, I want to edit my feature layer without using Editor or TemplatePicker.&amp;nbsp; I need for the point to be added where the address is located, so using the resulting graphic from my locator is perfect.&amp;nbsp; But how to edit the attribute information from here is not clear.&amp;nbsp; I only "think" I need to pass the fields to my graphic.&amp;nbsp; The post I read gave me the impression I would then have access to the attributeInspector.&amp;nbsp; I would like to pass the address from my locator to a field in the database, but every other attribute will be entered by my user.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:54:42 GMT</pubDate>
    <dc:creator>KathleenBrenkert</dc:creator>
    <dc:date>2021-12-12T03:54:42Z</dc:date>
    <item>
      <title>adding a graphic to a featurelayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659735#M14737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have passed the resulting graphic from my address locator to my FeatureLayer and it successfully adds a point to the database.&amp;nbsp; My next step would be to enter some attributes but I can't quite figure out the best way to do it.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I found 1 post that suggested looping through the featurelayer's layerinfo.fields to get the fields and set them to my graphic's attribute collection.&amp;nbsp; Would anyone have an example I can work from?&amp;nbsp; Other ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 13:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659735#M14737</guid>
      <dc:creator>KathleenBrenkert</dc:creator>
      <dc:date>2010-10-07T13:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: adding a graphic to a featurelayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659736#M14738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;LayerDetails has a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/supportClasses/LayerDetails.html#fields" rel="nofollow noopener noreferrer" target="_blank"&gt;fields&lt;/A&gt;&lt;SPAN&gt; element, which I think contains a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/supportClasses/Field.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Field&lt;/A&gt;&lt;SPAN&gt; object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what you could do is something like this pseudocode&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var ld:LayerDetails = fLayer.layerDetails;
var field:Field;
for each (field in ld.fields) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // probably loop through graphics
&amp;nbsp;&amp;nbsp;&amp;nbsp; var g:Graphic;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each (g in fLayer.graphicsProvider) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.attributes[field.name] = "somedata"; // probably some if/else/switch to grab address info
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That could be a start, you'd just need to get your data to the right fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Either way, you should be able to find Field names/aliases/types in fLayer.layerDetails.fields.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:54:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659736#M14738</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-12T03:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: adding a graphic to a featurelayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659737#M14739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That got me started.&amp;nbsp; I added this code to my application and I'm obviously missing an array, I get the very last field in my database assigned to my graphic.&amp;nbsp; However, after inserting this code myGraphic no longer gets added as a point to my featureLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var ld:LayerDetails=myFeatureLayer.layerDetails;
var field:Field;
for each (field in ld.fields)
{
 myGraphic.attributes=field.name;
}
myFeatureLayer.applyEdits([myGraphic], null, null);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure I'm approaching this right, I want to edit my feature layer without using Editor or TemplatePicker.&amp;nbsp; I need for the point to be added where the address is located, so using the resulting graphic from my locator is perfect.&amp;nbsp; But how to edit the attribute information from here is not clear.&amp;nbsp; I only "think" I need to pass the fields to my graphic.&amp;nbsp; The post I read gave me the impression I would then have access to the attributeInspector.&amp;nbsp; I would like to pass the address from my locator to a field in the database, but every other attribute will be entered by my user.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:54:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659737#M14739</guid>
      <dc:creator>KathleenBrenkert</dc:creator>
      <dc:date>2021-12-12T03:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: adding a graphic to a featurelayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659738#M14740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This sample may help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=AttributeInspectorInfoWindowEditable"&gt;http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=AttributeInspectorInfoWindowEditable&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One issue in the code above is that the attributes should be an Object of key-value pairs. You may also want to try using a tool like HttpFox to see what the request and response from the server is when you call applyEdits().&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Oct 2010 19:22:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659738#M14740</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2010-10-11T19:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: adding a graphic to a featurelayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659739#M14741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks to you both, after revisiting my code with your suggestions I realized I was looking at it wrong.&amp;nbsp; I was trying to pull my field names from my feature layer to assign them to my graphic, but that was not necessary.&amp;nbsp; All I had to do was assign attributes to my graphic that matched the field names in my feature layer.&amp;nbsp; I also added a basic form and then assigned each attribute a value from one of my form items.&amp;nbsp; sample of code below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
g.attributes={Field1: formitem1.text, Field2: formitem2.text}&amp;nbsp; 
myFeatureLayer.applyEdits(&lt;G&gt;, null, null);

&lt;/G&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:54:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-graphic-to-a-featurelayer/m-p/659739#M14741</guid>
      <dc:creator>KathleenBrenkert</dc:creator>
      <dc:date>2021-12-12T03:54:45Z</dc:date>
    </item>
  </channel>
</rss>

