Hello everyone,
I am working in the dashboard. I want to create two buttons in the category item. Currently there are no fields with these names, so I feel like I need to create them so I can add them as buttons. Here are my thoughts.
I need to add two columns to my dataset. The information is coming from an existing column. I want to group the data as is below in officergroup and citizengroup. I found a few articles in the forum to help me. My first question though is in the dictionary do I need to list all my columns that are currently in the dataset, or just the new ones? Then I do not know how to create columns? Which is which is why I have ??? marks in the Iff, else below. All suggestions are appreciated.
var choicesDict = {'fields': [{ 'name': 'Rin', 'type': 'esriFieldTypeString'},
{ 'name': 'Occ_date', 'type': 'esriFieldTypeDate'},
{ 'name': 'How_received_desc', 'type': 'esriFieldTypeString'},
{ 'name': 'officerinitiated', 'type': 'esriFieldTypeString'},
{ 'name': 'citizeninitiated', 'type': 'esriFieldTypeString'}],
'geometryType': '',
'features': []};
//this is where I want to group the data from How_received_desc column into the //two new columns
for (var feature in fs) {
var id = feature["ID"]
var officergroup = Iif(feature[‘How_received_desc’] == ('Onview’, 'Officer Request', ???, null)
var citizengroup = Iif(feature[‘How_received_desc’] == (‘Telephone/Radio’, ‘E911 System’, ‘Alarm Company’, ‘Text to 911’, ‘Outside Agency’, ‘Recurring Call’, ???, null)
Push(choicesDict.features, {“attributes”: {“Rin”: Rin,
“Occ_date”: Occ_date,
“How_received_desc”: How_received_desc,
“officerinitiated”: officerinitiated,
“citizeninitiated”: citizeninitated}})
Var fs_dict = FeatureSet(Text(choicesDict));
Return fs_dict
Return GroupBy(fs_dict, [‘ID’],
[{name: ‘How_received_desc’, expression: ‘How_received_desc’, statistic: ‘COUNT’},
{name: ‘officerinitiated’, expression: ‘officerinitiated’, statistic: ‘COUNT’},
{name: ‘citizenintiated’, expression: ‘citizeninitiated’, statistic: ‘COUNT’}]);
Thank you!