I am a novice javascript programmer. I have my site working very well now to do most everything I want. I am stuck on the last couple pieces though. I have a select button working where a user clicks the button then draws around an area to highlight points. These points then sum up a total amount and displays this total amount to the user. This part works great.Where I am stuck is that I want to take the regions that these points fall within and then subtract that total from the whole regions total. So for instance:A region might have 100 points which total $10,000...another region might have 50 points that total $5,000...If a user selects points from region A and region B then I want to pass back to the user the total of the new region and the new totals of region A and region B. As a test in my code I am passing back the region ID to the user currently just to see if everything is working. I am only getting one region ID back though if the user selects points from multiple regions. How do I get all of the region ID's to come back? And then in turn after I get the region id's how do I do the other calculation on the fly? Below is my code for the function that sums the points selected and displays that value and just one region id. Thanks in advance!// Sum Accounts Function
function sumAccounts(features) {
var imputedSum = 0;
var regionSSO;
dojo.forEach(features, function(feature) {
imputedSum = imputedSum + feature.attributes.F80_Q_num;
regionSSO = feature.attributes.EMPLOYEENUMBER;
});
var formattedImputedSum = dojo.number.format(imputedSum)
dojo.byId('messages').innerHTML = "Total 80Q Accounts: $" + formattedImputedSum + "";
dojo.byId('messages2').innerHTML = "Rep SSO: " + regionSSO + "";
}