dashboard arcade

466
5
07-21-2022 03:19 PM
by Anonymous User
Not applicable

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!

 

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

Arcade in Dashboards? Count me in!

So, you're basically just grouping the data into two groups, right? If that's the case, you could simply use GroupBy and skip the FeatureSet entirely.

If we do that, though, the output FeatureSet will not have any attributes that tie it back to the original data. Correct me if I'm wrong, though, but it sounds like you want to use these two groups to act as a filter, right?

- Josh Carlson
Kendall County GIS
0 Kudos
by Anonymous User
Not applicable

Yes!  The idea is to take items from a single field and group them into two categories (Officer initiated or Citizen initiated) then make a category selector with those 2 buttons.  Thank you Josh.

0 Kudos
jcarlson
MVP Esteemed Contributor

Okay. This is sort of similar to something I use in a few dashboards. It can kind of work, but you won't be able to connect the buttons directly to a map, since a category selector will require any filtered category to be linked by the same field that the categories come from.

In short, to filter a map straight from a category selector, you'll need the category to be a hard-coded field.

In the dashboards where we use this function, we have a List (though a Table could work, too) that uses the same data expression as the category selector, and a selection in the list filters / zooms the map. Would that fit your dashboard?

You know what would really solve this? If dashboards had a "contains any of..." filter option for selectors!

- Josh Carlson
Kendall County GIS
0 Kudos
by Anonymous User
Not applicable

Josh,

Are you saying use the List widget in the dashboard instead of Category selector? And when you say hard code you mean prior to bringing data into the enterprise to create the two columns and add the data, right? Thank you.

0 Kudos
jcarlson
MVP Esteemed Contributor

I mean you'd need to go Category Selector → List Widget → Map in order to use the expression-based categories, no using them directly against the map.

And yes, I mean a real field and data values would need to be added to the table in order to use the category selector directly against map features.

- Josh Carlson
Kendall County GIS
0 Kudos