Hi Josh,
Sorry for multiple messages.
I pasted in the code from the website you sent me and it says "Unable to parse script. Check your syntax". So I just continued modifying the script anyway, but it still says it for Line 24. Would you be able to look it over and let me know what you think? I put Line 24 in bold. If a screenshot is easier since it has the spacing, let me know.
// Reference layer using the FeatureSetByPortalItem() method.
var portal = Portal('https://sql2017.w2k.co.camden.nj.us/')
var fs = FeatureSetByPortalItem(
portal,
'7685831f1c4c4592ac7930bda21c9085',
0,
['Municipalities'],
false
);
// Create empty array for features and feat object
var features = [];
var feat;
// Split comma separated hazard types and store in dictionary.
for (var feature in fs) {
var split_array = Split(feature["Municipalities"], ',')
var count_arr = Count(split_array)
for(var i = 0; i < count_arr; i++ ){
feat = {
'attributes': {
'split_choices': Trim(split_array[i])
}
Push(features, feat);
}}}
// Empty dictionary to capture each hazard reported as separate rows.
var choicesDict = {
'fields': [
{ 'name': 'split_choices', 'type': 'esriFieldTypeString'}],
'geometryType': '',
'features': features
};
// Convert dictionary to featureSet.
var fs_dict = FeatureSet(Text(choicesDict));
// Return featureset after grouping by hazard types.
return GroupBy(fs_dict, ['split_choices'],
[{ name: 'split_count', expression: 'split_choices', statistic: 'COUNT' }]);
A side note: I also will need to add something in the code that basically says to only include features that fall under our "Status" Domain as: Planning, In Design, and In Construction. We also have Substantial Completion, Final Completion and Closed with Finance that are considered "completed" projects, and will not be on this bar chart. I think I'll need to have two charts - one for the first 3 categories, and another for the last 3 categories. Hopefully this makes sense. I basically need to query the data for the bar chart to only include specific categories of projects.
Thank you again for your time and help.