 
					
				
		
Hi all,
I am trying to get a feature count per user names. I have an array of unique user names that I want to loop through and produce as series of counts/users. How would I achieve this?
Thanks,
Alex
Solved! Go to Solution.
 
					
				
		
Nervermind. I got it. This query set up solved it for me.
Thanks,
Alex
 var queryloop = new Query();
                var queryTaskloop = new QueryTask("http://services.arcgis.com/UHg8l1wC48WQyDSO/arcgis/rest/services/U64gI/FeatureServer/0");
                arrayUtil.forEach(unique, function (feature) {
                    console.log(feature)
                    queryloop.where = "f3 = " + "'" + feature + "'";  
                    queryloop.returnGeometry = false;
                    queryloop.outFields = ["*"];
                    queryTaskloop.execute(queryloop, queryCallbacksum);
                });??? What does feature count and username have in common? You need to explain way better.
 
					
				
		
Sorry,
Lest say I have 10 users. Each one of their appI want to count how many times they appear in my table. Kind of a summary.
username: count:
John F. 68
Peter A. 189
Julie F. 92
Mark A. 178
Julius F. 550
.
.....
In my table I have a count field that I calculated to 1 so I can sum up the users like this:
 function queryCallbacksum(featureSet) {
                    var features = featureSet.features;
                    sum = 0;
                    arrayUtil.forEach(features, function (feature) {
                        sum += feature.attributes.CountField;
                    });
                    console.log(sum)
                   
                }I am trying to set a loop that would produce a count per users like this :
//My  array made of unique names
unique = arraynames.filter(function(itm, i, a) {
                return i == arraynames.indexOf(itm);
                });
//My create queries loop
                arrayUtil.forEach(unique, function (feature) {
                    var queryloop = new Query();
                    var queryTaskloop = new QueryTask("http://services.arcgis.com/UHg8l1wC48WQyDSO/arcgis/rest/services/U64gI/FeatureServer/0");
                    queryloop.where = "f3 =" + feature;  
                    queryloop.returnGeometry = false;
                    queryloop.outFields = ["CountField"];
                    queryTaskloop.execute(queryloop, queryCallbacksum);
                }); 
					
				
		
Nervermind. I got it. This query set up solved it for me.
Thanks,
Alex
 var queryloop = new Query();
                var queryTaskloop = new QueryTask("http://services.arcgis.com/UHg8l1wC48WQyDSO/arcgis/rest/services/U64gI/FeatureServer/0");
                arrayUtil.forEach(unique, function (feature) {
                    console.log(feature)
                    queryloop.where = "f3 = " + "'" + feature + "'";  
                    queryloop.returnGeometry = false;
                    queryloop.outFields = ["*"];
                    queryTaskloop.execute(queryloop, queryCallbacksum);
                });