<?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: Geometry as a ComboBox value in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655191#M14656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much Robert!&amp;nbsp; That got it.&amp;nbsp; Indeed you are powerful... ~Vader&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I have a ComboBox of feature layer geometries that is populated from a querytask. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Aaron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Apr 2013 13:13:00 GMT</pubDate>
    <dc:creator>AaronPerry</dc:creator>
    <dc:date>2013-04-25T13:13:00Z</dc:date>
    <item>
      <title>Geometry as a ComboBox value</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655189#M14654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to have a combobox use a graphic's geometry as it's value. I don't know if this is even possible, and I can't find anything definitive on the subject. I'm hoping some of the geniuses here can shed some light on the subject.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Right now I have a combobox that I have populated from an array collection built by a querytask response. Technically it is 4 querytask responses in array collections that are merged into a single array collection when all the tokens light up true. Then this single array collection is assigned as the dataprovider for the combobox. I'm setting up the collection in this manner: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;collection.addItem({label:fieldValue, data:graphic.geometry}) // where field value is a string&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then assigning it like this after concatenating the collections:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cmb1.labelField = "label";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cmb1.dataProvider = mergedCollection; // where mergedCollection is a concatenation of collections as created above&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that when I then select an item from the seemingly populated combobox and submit the query I get the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[RPC Fault faultString="Unable to complete operation." faultCode="400" faultDetail="'where' parameter not specified&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'objectIds' parameter not specified&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'time' parameter not specified&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'geometry' parameter not specified&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'text' parameter not specified&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unable to complete Query operation."]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a sample of my code. The whole process of populating the combobox starts in initCombo(). Hopefully you can follow it from there. I also included doQuery() which is called from a button after the user picks something from the combobox.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

private function initCombo():void
{
 var baseURL:String = "http://myserver/ArcGIS/rest/services/mystuff/MapServer/"

 var tokenCounter:int = 0;

 // tokens is an array collection of objects 
 // only feature layers 7 to 10 are relevant for this combobox
 for (var i:int = 7; i &amp;lt; 11; i++) {
&amp;nbsp; queryTask.url = baseURL + i.toString();
&amp;nbsp; queryTask.execute(query, new AsyncResponder(onResult, onFault, tokens.getItemAt(tokenCounter)));
&amp;nbsp; tokenCounter++;
 }
 
 function onResult(featureSet:FeatureSet, token:Object = null):void
 {
&amp;nbsp; for each (var graphic:Graphic in featureSet.features)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; var fieldValue:String = token.name + " " + graphic.attributes["OBJECTID_1"].toString();
&amp;nbsp;&amp;nbsp; token.collection.addItem({label:fieldValue, data:graphic.geometry});
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; for each (var item:Object in tokens)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; // probably a better way to get a handle back to global collections than this
&amp;nbsp;&amp;nbsp; if (item.name == token.name) 
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; item.collection = token.collection;
&amp;nbsp;&amp;nbsp;&amp;nbsp; item.completed = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; // if all the tokens are true, merge the collections into one
&amp;nbsp; if (checkTokens()){
&amp;nbsp;&amp;nbsp; // collections is an array containing the array collections so I can iterate through them
&amp;nbsp;&amp;nbsp; for (var i:int = 0; i &amp;lt; collections.length; i++)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; mergedCollection = new ArrayCollection(result.source.concat(collections&lt;I&gt;.source)); 
&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; cmb1.labelField = "label";
&amp;nbsp;&amp;nbsp; cmb1.dataProvider = mergedCollection;
&amp;nbsp; }
 }
 
 function onFault(info:Object, token:Object = null):void
 {
&amp;nbsp; Alert.show(info.toString(), "Query Problem");
 }
}

private function checkTokens():Boolean
{
 for (var i:int = 0; i &amp;lt; tokens.length; i++)
 {
&amp;nbsp; if (!(tokens&lt;I&gt;.completed))
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp; }
 }
 return true;
}

private function doQuery():void
{
 graphicsLayer.clear();
 
 query.where = "";
 
 // I thought this would be the geometry returned by the query
 query.geometry = cmb1.selectedItem.value;
 
 queryTask.execute(query, new AsyncResponder(onResult, onFault));
 
 function onResult(featureSet:FeatureSet, token:Object = null):void
 {
&amp;nbsp; var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
&amp;nbsp; if (graphicsExtent)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.extent = graphicsExtent;
&amp;nbsp; }
&amp;nbsp; graphicsLayer.graphicProvider = featureSet.features;
 }
 
 function onFault(info:Object, token:Object = null):void
 {
&amp;nbsp; Alert.show(info.toString(), "Query Problem");
 }
}

&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the MXML for my combobox:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;s:ComboBox id="cmb1" x="179" y="205" labelField=""/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Aaron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655189#M14654</guid>
      <dc:creator>AaronPerry</dc:creator>
      <dc:date>2021-12-12T16:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry as a ComboBox value</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655190#M14655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Aaron,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Try replacing your similar line with this one:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;query.geometry = cmb1.selectedItem.data;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 20:40:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655190#M14655</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2013-04-24T20:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry as a ComboBox value</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655191#M14656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much Robert!&amp;nbsp; That got it.&amp;nbsp; Indeed you are powerful... ~Vader&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I have a ComboBox of feature layer geometries that is populated from a querytask. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Aaron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:13:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/geometry-as-a-combobox-value/m-p/655191#M14656</guid>
      <dc:creator>AaronPerry</dc:creator>
      <dc:date>2013-04-25T13:13:00Z</dc:date>
    </item>
  </channel>
</rss>

