Select to view content in your preferred language

customized arcgis sample for flex SearchWidget cannot get the expect field value arraylist

2396
4
Jump to solution
11-25-2014 12:01 AM
WuYang
by
Emerging Contributor

I am new to flex. Now I am trying to customize the SearchWidget from arcgis-samples-flex-3.6-src. What I want to do is:

(1) use the drawing tools provide in the sample on a layer from the layer list.

(2) get a specified field values of all the features in the drawing area (of the selected layer) in a arraylist.

Now I can access the layer, but I failed to get the expected arraylist (the fieldValues in the following code).

private function queryFeaturesGraphical(geom:Geometry):void
  {
  hideInfoWindow();
  var searchLayer:Object = cboLayerGraphical.selectedItem;

  queryLayer = searchLayer.layer;
  retrieveFieldValue(searchLayer);
  }

private function retrieveFieldValue(obj:Object):void
{
  CursorManager.removeBusyCursor();
  var fieldset:FeatureSet = obj as FeatureSet;

  fieldValues = uniqueArray(fieldset.features);
}

private function uniqueArray(arr:Array) : Array
{
  var unique : Array = new Array();
  var contains : Boolean;

  for( var i:Number = 0; i<arr.length; i++ )
  {
  contains = false;
  unique.push(arr); 
  }
  return unique;
  }
}

What I use is arcgis flex api 3.6 and flash builder 4.6.

Would anybody please advice me what is wrong with my code? thanks.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Leaf,

   Is there parts of your queryFeaturesGraphical function that you have omitted for some reason?

I don't search anywhere in that function that an actual query occurs on the queryLayer...

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Leaf,

   Is there parts of your queryFeaturesGraphical function that you have omitted for some reason?

I don't search anywhere in that function that an actual query occurs on the queryLayer...

0 Kudos
WuYang
by
Emerging Contributor

Thanks Robert,

I didn't post part of the queryFeaturesGraphical because the program is stuck when performing onFieldValuesRereivalsuccess at the line of

mFldValues = uniqueArray(fset.features);

I cannot figure out the reason.

I will check the code for the query part.

Best Regards

0 Kudos
WuYang
by
Emerging Contributor

Hello Robert,

Currently I am trying to confirm whether I can get the features selected first, in this case I follow the SearchWidget (just modified the xml to catering to my map service).

Since it is a different question, I posted it as a new thread:

https://community.esri.com//thread/117907

Appreciate if you can have a look, thank you.

0 Kudos
WuYang
by
Emerging Contributor

Hi Robert,

I have already got the issue fixed, thanks for the kind help.

0 Kudos