Select to view content in your preferred language

Using StatisticDefinition in a QueryTask

3169
1
Jump to solution
11-25-2014 02:23 PM
DavidMarquardt
New Contributor III

Hello,

 

I have a question about using QueryTask to do two things:

 

1. Identify unique value for a record in a graphics layer via mouseover.  This unique value (from a specified field) is used to create a barchart

2. Use StatisticDefinition to obtain the maximum value possible for all records in a field.  I want to use the max value to set the limit to the barchart length

 

Unfortunately, I seem to be able to do only one or the other: If I obtain the maximum value, I can't get the graphicsLayer to display.  if I get the graphicsLayer to show, then the statisticDefinition doesn't work. 

 

I need some help understanding how QueryTask works.  Can it only do one thing?  Should I make two queryTasks to manage my two actions?  If so, how do I synchronize them?

 

I'm attaching my script (needs a mapservice that allows for modification of layer order and symbology to function) and an image showing how the horizontal bar chart works.  At this point, I'm looking for general suggestions, these two attachments are included only if it helps to better understand my question. 

 

Thank you for your input,

 

David

0 Kudos
1 Solution

Accepted Solutions
DavidMarquardt
New Contributor III

Looks like QueryTask does not allow for geometry when using statistics:

from Query api for outStatistics parameter (query-amd | API Reference | ArcGIS API for JavaScript 😞

"The definitions for one or more field-based statistic to be calculated. outStatistics is only supported on layers/tables where supportsStatistics is true. If outStatistics is specified the only other query parameters that will be used are groupByFieldsForStatistics, orderByFields, text, timeExtent and where."

View solution in original post

0 Kudos
1 Reply
DavidMarquardt
New Contributor III

Looks like QueryTask does not allow for geometry when using statistics:

from Query api for outStatistics parameter (query-amd | API Reference | ArcGIS API for JavaScript 😞

"The definitions for one or more field-based statistic to be calculated. outStatistics is only supported on layers/tables where supportsStatistics is true. If outStatistics is specified the only other query parameters that will be used are groupByFieldsForStatistics, orderByFields, text, timeExtent and where."

0 Kudos