Spencer and Alexander,There are, of course, two stages.
- Populate the combobox with items from a layer during application intialization.
- Use the user selected item to query agains that layer
One problem with step one that I had was that the items in the layer were not unique, but I needed to provide a unique list for the user. First I did a query to return all records in the layer. Then I filtered that returned dataset for unique values of the field I wanted to use to populate the control. The code below shows how I filtered the data. I actually used a drop down list control, but the process is the same.
private function onDDLInitComplete(fSet:FeatureSet, token:Object=null):void
{
//defines and sorts a unique list of values for the drop down list control
//Populates the bindable application variable ddlValuesAC
var i:int = 1;
var item:String;
var sortAttr:Array=fSet.attributes.sortOn("FieldName");
for (var j:int=0; j<fSet.attributes.length-1; j++)
{
item = sortAttr.FieldName;
//getItemIndex returns -1 it item is not found in the array
i=ddlValuesAC.getItemIndex(item);
if (i==-1){
ddlValuesAC.addItem(item);
}
}
}
Now that I have a drop down list with just the unique values from the layer, I can return one to many records depending on the user's selection. Code example below.
protected function ddlControl_changeHandler(event:IndexChangeEvent):void
{
mapQuery.where="fieldName = '" + ddlControl.selectedItem + "'";
mapQuery.geometry = null; //this in case geometry was used in previous query
mapQueryTask.execute(mapQuery, new AsyncResponder(onQueryExecuteComplete, onFault));
}
You will use the onQueryExecuteCompleteFunction to display the data to the user in the manner that meets your application requirements. Likely you will use the results to populate a variable that is bound to the dataProvider attribute of a dataGrid control.Good Luck,-Dan