Return statistics on featureSet attribute values
I have a query task that returns a featureSet. I need to be able to return statistics on multiple attributes within the featureSet. For example, my query returns a featureSet of 5 features. I need to perform and display stats (low, avg, median, high sale price) based off of the S_PRICE attribute field; AND stats (low, avg, median, high sale price/sqft) based off the S_PRICESQFT attribute field. I've looked at the query task Out Statistics argument but not exactly sure how to implement it. Or, I also thought I could loop through each graphic of the featureSet, then loop through each attribute field of each graphic to get the specific attribute values i need, dump them into some type of collection, sort it, then perform the stats on the collection; however, I can't get anything to work. Any thoughts, suggestions, examples/samples would be greatly appreciated.
0
-
The QueryTask's OutStatistics is a list of all the statistics you need, and can be set as follows { New OutStatistic ("S_PRICE", "MAX_S_PRICE", StatisticType.Max), New OutStatistic ("S_PRICE", "MIN_S_PRICE", StatisticType.Min) }The first parameter is the actual fieldname that you want to run the stats on, the second one is the fieldname in the resulting featureset, and the third is the type of statistic. Add as many OutStatistic objects as you like to this list.
This example will return a featureset with a single feature and attributes MAX_S_PRICE and MIN_S_PRICE.
Supported statistic types are: Average, Count, Max, Min, StandardDeviation, Sum and Variance. Median seems not to be supported, I'm not sure if there is some kind of workaround for that.0 -
Thanks Berend. So, how can I then get the newly created fields (MAX_S_PRICE, MIN_S_PRICE) attribute values? 0 -
I'm also getting an error message that states :
_img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000bqQR&feoid=Body&refid=0EMf2000000cZs6"_/_img_0 -
That list should go directly into the QueryTask's OutStatistics property, which is a list of OutStatistic objects.
Once you have the featureset, you can get the values in the same way you would read any attribute: featureset.Features.First.Attributes("MIN_S_PRICE")0 -
Thanks for the reply Berend. I'm new to Geocortex and Workflows so your help is greatly appreciated. Ok, I have placed the list directly into the QueryTask's OutStatistics property; however, I'm receiving an error from the QueryTask. My QueryTask worked before entering the OutStatistics property. Below is a screen shot of my QueryTask and the error message._img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000bqRA&feoid=Body&refid=0EMf2000000cZsB" _/_img_
_img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000bqRA&feoid=Body&refid=0EMf2000000cZsG"_/_img_0 -
That seems like a (network) problem with your ArcGIS Server, rather than a problem with the Query Task. 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
6 kommentarer