<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How group or aggregate all other respond which come from Survey123 to one bar chart? in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114889#M5353</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;Thanks for this&lt;BR /&gt;this is great but I know some arcade code doesn't allow you to create actions. is it normal or I need to change the code to enable Action.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Nov 2021 14:42:46 GMT</pubDate>
    <dc:creator>anonymous55</dc:creator>
    <dc:date>2021-11-08T14:42:46Z</dc:date>
    <item>
      <title>How group or aggregate all other respond which come from Survey123 to one bar chart?</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114273#M5344</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to aggregate all answers which user choose other and type his/her respond on the box in survey123. I just want to show how many other respond but I don't want to see actual answers.&lt;BR /&gt;you can see below a screen shot which i couldn't find the way and I just want to have one bar for all other together.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ARM_1-1636054858366.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/26871iFA97DF50AF9B25C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ARM_1-1636054858366.png" alt="ARM_1-1636054858366.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have this arcade code which group each respond but I don't know how can I add other to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Reference layer using the FeatureSetByPortalItem() method. 
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), 
'itemID' , 0, 
['neighborhood'], 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["neighborhood"], ',') 
    var count_arr = Count(split_array) 
    for(var i = 0; i &amp;lt; 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' }]);  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 19:46:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114273#M5344</guid>
      <dc:creator>anonymous55</dc:creator>
      <dc:date>2021-11-04T19:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: How group or aggregate all other respond which come from Survey123 to one bar chart?</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114380#M5346</link>
      <description>&lt;P&gt;I would assume from your post that this is coming from a survey? How are these "other" values getting into the `neighborhood` field? Are you concatenating choices from the survey?&lt;/P&gt;&lt;P&gt;Anyway, we can group all the "other" responses by using a list and matching against it. The Data Expression examples have yet to be updated to include this, but recent updates to the Arcade language enable us to use &lt;STRONG&gt;Push&lt;/STRONG&gt; to populate an array, rather than using an index variable.&lt;/P&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Get layer
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), 
'itemID' , 0, 
['neighborhood'], false);

// Define list of expected values
var categories = [
    'Agressive Drivers',
    'etc',
    'etc'
]

// Empty feature array
var features = []

// Split choices, populate feature array
for (var feature in fs) {
    var split_array  =  Split(feature["neighborhood"], ',') 
    var count_arr = Count(split_array) 

    for(var i = 0; i &amp;lt; count_arr; i++ ){ 
        var cat = Trim(split_array[i])

        if(Includes(categories, cat)){
            var feat = {'attributes': {'split_choices': cat}}
        } else {
            var feat = {'attributes': {'split_choices': 'Other'}}
        }

        Push(features, feat)
    }
}

// EDictionary w/ features
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' }]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do note, however, that the final "GroupBy" isn't necessary if the chart is all you need this for; the chart can handle the summing for you.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 01:37:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114380#M5346</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-11-05T01:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How group or aggregate all other respond which come from Survey123 to one bar chart?</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114889#M5353</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;Thanks for this&lt;BR /&gt;this is great but I know some arcade code doesn't allow you to create actions. is it normal or I need to change the code to enable Action.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 14:42:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-group-or-aggregate-all-other-respond-which/m-p/1114889#M5353</guid>
      <dc:creator>anonymous55</dc:creator>
      <dc:date>2021-11-08T14:42:46Z</dc:date>
    </item>
  </channel>
</rss>

