<?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: Code Question in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574096#M12956</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dasa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That was it! Thanks again for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim Faron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Sep 2010 19:39:58 GMT</pubDate>
    <dc:creator>JamesFaron</dc:creator>
    <dc:date>2010-09-10T19:39:58Z</dc:date>
    <item>
      <title>Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574090#M12950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to create a variable that will show the string value of an Array object deliminated with a comma. In short, I have created an ArrayCollection from FeatureSet.Attributes, modified it as in the code below (from Dan yesterday), and then applied a 'for each' statement to create the string values. All well and good, but the values that are returned are not delimited (I need a comma separating the values so that I can use it as a variable in a script). I created an Array composed of the string output (myString in code), and I applied the conventional methods to return comma separated values (params.toString(); and then params.join(","), but the results are the same: I get the values of the Array strung together without a delimiter. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function onRbeResult(featureSet:FeatureSet, token:Object = null):void&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;&amp;nbsp;&amp;nbsp; try
&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; for each (var gra:Graphic in featureSet.features)&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; var obj:Object = gra.attributes;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obj["gid"] = gid;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gid +=1;
&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; gridDataProvider = featureSet.attributes;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LLdata.dataProvider = gridDataProvider;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var recAC:ArrayCollection = createRbeRecordData(featureSet,rbeID);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wRepeater.dataProvider = recAC;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var stopAC:ArrayCollection = new ArrayCollection;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var newObj:Object;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var j:int=0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(j=0;j&amp;lt;featureSet.attributes.length; j++)
&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; newObj = featureSet.attributes&lt;J&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete newObj.NAME;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete newObj.POLICY;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stopAC.addItem(newObj);
&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; for each( var obj:Object in stopAC )
&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; for each( var obj2:Object in obj )
&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; myString += String( obj2 );
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trace(myString);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var params:Array = new Array(myString);
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var paramsCSV:String = params.toString();//didn't work
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var paramsCSV:String = params.join(",");//didn't work either
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show(paramsCSV);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trace(paramsCSV);&lt;/J&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result of the trace is always as follows (the results change dynamically, but no change in format): null0642473168584021869369384069146424735691143668584076662168642473&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I am looking for is e.g.642473,685840,1869369,etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps the null value is creating a problem, or the code is wrong. Any help or pointers will be greatly appreciated, as always.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim Faron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Sep 2010 17:02:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574090#M12950</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2010-09-10T17:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574091#M12951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It looks like your params:Array only has one value in it. It needs to have more than one value for join() to concatenate them. You could try pushing values into the array inside your for loop, or just creating the string the way you want manually.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Sep 2010 17:10:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574091#M12951</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2010-09-10T17:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574092#M12952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dasa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the relevant code according to your suggestion (params.push(myString), and it is starting to do what I expect. However the results now appears as "null&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;642473&lt;/SPAN&gt;&lt;SPAN&gt;,null6424730,null6424730&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;685840&lt;/SPAN&gt;&lt;SPAN&gt;,null64247306858401,null6424730685840&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;11869369&lt;/SPAN&gt;&lt;SPAN&gt;etc'. Each value being with 'null' contains the first value with an incremental increase from the next value (with the addition of a 0). What I am aiming at is to return 642473,685840,11869369 etc(as underlined above).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't manually create the string because it is the result of dynamic function, so that the results will change everytime the function is called.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that the 'myString' loop is the problem. It is intended to display the text value of the ArrayCollection objects (otherwise I would trace [Object,object]. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var stopAC:ArrayCollection = new ArrayCollection;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var newObj:Object;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var j:int=0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(j=0;j&amp;lt;featureSet.attributes.length; j++)
&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; newObj = featureSet.attributes&lt;J&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete newObj.NAME;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete newObj.POLICY;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stopAC.addItem(newObj);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
var params:Array = new Array;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for each( var obj:Object in stopAC )
&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; for each( var obj2:Object in obj )
&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; myString += String( obj2 );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.push(myString);
&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; }
var paramsCSV:String = params.join(",");
trace(paramsCSV);&lt;/J&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like I'm getting closer, but I am definitely missing something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim Faron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:42:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574092#M12952</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2021-12-12T00:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574093#M12953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I understand correctly, you want a comma separated list of of values of one of the features' attributes? Is this correct? What is the name of the attribute?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One note is that it's best to only call featureSet.attributes once since this creates a new Array every time it's called:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/FeatureSet.html#attributes"&gt;http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/FeatureSet.html#attributes&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Sep 2010 18:47:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574093#M12953</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2010-09-10T18:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574094#M12954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, you are correct. The featureset.Attributes has three fields: Name, Policy, and Stop_id. I only want the Stop_id in the comma separated list variable. I intend to use that variable to send to a Webservice in a script. I can make the Webservice and script work by using the selectedItem of a list (I define the labelField=Stop_ID). I want to send multiple values, in fact all of the values each time the function is run. If there is another way to do this, I would love to know. For example, if there is a better way to get the text value of the one field (Stop_ID) that is contained in featureSet.attributes, that would be fantastic. I would rather not, if I don't have to, limit featureSet.Attributes to one field only in the function (the fields are defined in the config.xml), as that would affect its use as a dataProvider for a grid.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Sep 2010 19:18:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574094#M12954</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2010-09-10T19:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574095#M12955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's how I would do this. You could use featureSet.attributes, but I think looping through the features makes the code clearer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var ids:Array = [];
for each (var graphic:Graphic in featureSet.features)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; ids.push(graphic.attributes["Stop_ID"]);
}
var paramsCSV:String = ids.join();
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:42:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574095#M12955</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2021-12-12T00:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574096#M12956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dasa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That was it! Thanks again for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim Faron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Sep 2010 19:39:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/code-question/m-p/574096#M12956</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2010-09-10T19:39:58Z</dc:date>
    </item>
  </channel>
</rss>

