Hi everyone.
I'm trying some advanced arcade expressions in dashboard and I need some help.
My data come from select_mutiple field create in survey 123. My attributes are comma separated (ex: Boucherie, Garage, Friperie) linked to a point geometry element.
With this expression, I'm able to split and store the attribute in a dictionary:
_________
// Reference layer using the FeatureSetByPortalItem() function.
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), '371113694bd24607b2e9d01e49024944' , 0, ['TypeLocatLabel'], false);
// Empty dictionary to capture each hazard reported as separate rows.
var choicesDict = {'fields': [{ 'name': 'split_choices', 'type': 'esriFieldTypeString'}],
'geometryType': '', 'features': []};
var index = 0;
// Split comma separated hazard types and store in dictionary.
for (var feature in fs) {
var split_array = Split(feature["TypeLocatLabel"], ',')
var count_arr = Count(split_array)
for(var i = 0; i < count_arr; i++ ){
choicesDict.features[index++] = {
'attributes': { 'split_choices': Trim(split_array[i]),
}}
}}
// 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' }]);
______
I use this expression in a category selector and this works fine. But in the end, when I select a category, the geometry don't show in the map. (Ex: If I choose Boucherie, I want all the points in this category to show in the map).
Anyone know what I'm forgetting? Can someone have one idea how improve my arcade expression to do that?