Hi! I found an example of some code to separate multi-select responses into separate records from the Esri Github. The code works great, except I need a few additional values added to the array so I can further filter the data using other widgets within the dashboard. Where would I add these additional fields? The fields are "date_time & type_of_activity".
// Reference layer using the FeatureSetByPortalItem() method.
var fs = FeatureSetByPortalItem(
portal,
'c68e6ea9b6b74c30bc94ef901d34f5f2',
0,
['focus_area'],
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["focus_area"], ',')
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' }]);