<?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 Dashboard Arcade Group Layers in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1238930#M7068</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to use an arcade expressions to combine three feature layers (pt, line, polygon) into one data table to graph a shared attributes. I have found many examples of others that have successfully deployed this idea using the information in this link.&lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CombineMultipleLayers(SerialChart).md" target="_self"&gt;&amp;nbsp;https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CombineMultipleLayers(SerialChart).md&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am not an arcade expert so I have been trying to follow this code and replace their attributes/ names with mine. Unfortunately I keep getting a errors. Specially "&lt;SPAN class=""&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN&gt;json" which does not mean much to me. I am wondering if anyone would be able to help figure out where I am going wrong. Here is the code that I have come up with following the github link.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any advice or suggestions would be awesome!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var portal = Portal('PORTAL_URL');&lt;BR /&gt;var point = GroupBy(FeatureSetByPortalItem(&lt;BR /&gt;portal,&lt;BR /&gt;'FEATURE_ID',&lt;BR /&gt;0,&lt;BR /&gt;['RBU','CatCode28'],&lt;BR /&gt;false),&lt;BR /&gt;['RBU'],&lt;BR /&gt;[&lt;BR /&gt;{ name: 'CatCode28_point', expression: 'Point_CatCode28', statistic: 'SUM' },&lt;BR /&gt;&lt;BR /&gt;]&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;var line = GroupBy(&lt;BR /&gt;FeatureSetByPortalItem(portal,'eba1d0d180a0419499566e4aa1336eea',0,&lt;BR /&gt;['RBU','CatCode28'],&lt;BR /&gt;false),&lt;BR /&gt;['RBU'],&lt;BR /&gt;[&lt;BR /&gt;{ name: 'CatCode28_line', expression: 'Line_CatCode28', statistic: 'SUM' },&lt;BR /&gt;&lt;BR /&gt;]&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;var poly = GroupBy(&lt;BR /&gt;FeatureSetByPortalItem(portal,'111b954c606045e18180d507fcc40aef',0,&lt;BR /&gt;['RBU','CatCode28'],&lt;BR /&gt;false),&lt;BR /&gt;['RBU'],&lt;BR /&gt;[&lt;BR /&gt;{ name: 'CatCode28_poly', expression: 'Poly_CatCode28', statistic: 'SUM' },&lt;BR /&gt;&lt;BR /&gt;]&lt;BR /&gt;);&lt;BR /&gt;// Create empty array for features, feat object to populate array&lt;BR /&gt;var features = [];&lt;BR /&gt;var feat;&lt;/P&gt;&lt;P&gt;// Loop through each of the three FeatureSets and populate feature array.&lt;BR /&gt;for (var p in point) {&lt;BR /&gt;feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;type: 'Points',&lt;BR /&gt;RBU: p['RBU'],&lt;BR /&gt;count_of_found: SUM(p['CatCode28_point']),&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;Push(features, feat);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;for (var l in line) {&lt;BR /&gt;feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;type: 'Line',&lt;BR /&gt;RBU: l['RBU'],&lt;BR /&gt;count_of_found: SUM(l['CatCode28_line']),&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;Push(features, feat);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;for (var g in polygon) {&lt;BR /&gt;feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;type: 'Polygon',&lt;BR /&gt;RBU: g['RBU'],&lt;BR /&gt;count_of_found: SUM(g['CatCode28_poly']),&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;Push(features, feat);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var combinedDict = {&lt;BR /&gt;fields: [&lt;BR /&gt;{ name: 'RBU', type: 'esriFieldTypeString' },&lt;BR /&gt;{ name: 'CateCode28', type: 'esriFieldTypeString' },&lt;BR /&gt;{ name: 'count_of_found', type: 'esriFieldTypeInteger' },&lt;BR /&gt;],&lt;BR /&gt;geometryType: '',&lt;BR /&gt;features: features,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// Return dictionary cast as a feature set&lt;BR /&gt;return FeatureSet(Text(combinedDict));&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 21:49:57 GMT</pubDate>
    <dc:creator>Michael_VanHatten</dc:creator>
    <dc:date>2022-12-07T21:49:57Z</dc:date>
    <item>
      <title>Dashboard Arcade Group Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1238930#M7068</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to use an arcade expressions to combine three feature layers (pt, line, polygon) into one data table to graph a shared attributes. I have found many examples of others that have successfully deployed this idea using the information in this link.&lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CombineMultipleLayers(SerialChart).md" target="_self"&gt;&amp;nbsp;https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CombineMultipleLayers(SerialChart).md&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am not an arcade expert so I have been trying to follow this code and replace their attributes/ names with mine. Unfortunately I keep getting a errors. Specially "&lt;SPAN class=""&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN&gt;json" which does not mean much to me. I am wondering if anyone would be able to help figure out where I am going wrong. Here is the code that I have come up with following the github link.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any advice or suggestions would be awesome!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var portal = Portal('PORTAL_URL');&lt;BR /&gt;var point = GroupBy(FeatureSetByPortalItem(&lt;BR /&gt;portal,&lt;BR /&gt;'FEATURE_ID',&lt;BR /&gt;0,&lt;BR /&gt;['RBU','CatCode28'],&lt;BR /&gt;false),&lt;BR /&gt;['RBU'],&lt;BR /&gt;[&lt;BR /&gt;{ name: 'CatCode28_point', expression: 'Point_CatCode28', statistic: 'SUM' },&lt;BR /&gt;&lt;BR /&gt;]&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;var line = GroupBy(&lt;BR /&gt;FeatureSetByPortalItem(portal,'eba1d0d180a0419499566e4aa1336eea',0,&lt;BR /&gt;['RBU','CatCode28'],&lt;BR /&gt;false),&lt;BR /&gt;['RBU'],&lt;BR /&gt;[&lt;BR /&gt;{ name: 'CatCode28_line', expression: 'Line_CatCode28', statistic: 'SUM' },&lt;BR /&gt;&lt;BR /&gt;]&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;var poly = GroupBy(&lt;BR /&gt;FeatureSetByPortalItem(portal,'111b954c606045e18180d507fcc40aef',0,&lt;BR /&gt;['RBU','CatCode28'],&lt;BR /&gt;false),&lt;BR /&gt;['RBU'],&lt;BR /&gt;[&lt;BR /&gt;{ name: 'CatCode28_poly', expression: 'Poly_CatCode28', statistic: 'SUM' },&lt;BR /&gt;&lt;BR /&gt;]&lt;BR /&gt;);&lt;BR /&gt;// Create empty array for features, feat object to populate array&lt;BR /&gt;var features = [];&lt;BR /&gt;var feat;&lt;/P&gt;&lt;P&gt;// Loop through each of the three FeatureSets and populate feature array.&lt;BR /&gt;for (var p in point) {&lt;BR /&gt;feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;type: 'Points',&lt;BR /&gt;RBU: p['RBU'],&lt;BR /&gt;count_of_found: SUM(p['CatCode28_point']),&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;Push(features, feat);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;for (var l in line) {&lt;BR /&gt;feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;type: 'Line',&lt;BR /&gt;RBU: l['RBU'],&lt;BR /&gt;count_of_found: SUM(l['CatCode28_line']),&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;Push(features, feat);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;for (var g in polygon) {&lt;BR /&gt;feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;type: 'Polygon',&lt;BR /&gt;RBU: g['RBU'],&lt;BR /&gt;count_of_found: SUM(g['CatCode28_poly']),&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;Push(features, feat);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var combinedDict = {&lt;BR /&gt;fields: [&lt;BR /&gt;{ name: 'RBU', type: 'esriFieldTypeString' },&lt;BR /&gt;{ name: 'CateCode28', type: 'esriFieldTypeString' },&lt;BR /&gt;{ name: 'count_of_found', type: 'esriFieldTypeInteger' },&lt;BR /&gt;],&lt;BR /&gt;geometryType: '',&lt;BR /&gt;features: features,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// Return dictionary cast as a feature set&lt;BR /&gt;return FeatureSet(Text(combinedDict));&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 21:49:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1238930#M7068</guid>
      <dc:creator>Michael_VanHatten</dc:creator>
      <dc:date>2022-12-07T21:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Arcade Group Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1238942#M7070</link>
      <description>&lt;P&gt;First of all, note the&amp;nbsp;&lt;STRONG&gt;code sample&amp;nbsp;&lt;/STRONG&gt;button on here. It can&amp;nbsp;&lt;EM&gt;really&amp;nbsp;&lt;/EM&gt;help others read and understand your expressions.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1670450338931.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57907i89DAE87629C95341/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1670450338931.png" alt="jcarlson_0-1670450338931.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Second,&amp;nbsp;&lt;STRONG&gt;point&lt;/STRONG&gt; is an Arcade function, so try using a different name for that FeatureSet.&lt;/P&gt;&lt;P&gt;Third, in GroupBy, if your grouping and statistics parameters only have a single item, you don't need to put them inside an array.&lt;/P&gt;&lt;P&gt;Fourth, your GroupBy expressions don't match the requested field names. This is not&amp;nbsp;&lt;EM&gt;necessarily&amp;nbsp;&lt;/EM&gt;a problem, but know that the expression you're supplying&amp;nbsp;&lt;EM&gt;must&amp;nbsp;&lt;/EM&gt;match a field name in the service. You don't have to have a field called&amp;nbsp;&lt;STRONG&gt;Point_CatCode28&lt;/STRONG&gt; in your requested list of fields, but it needs to be in the service, otherwise the expression won't evaluate.&lt;/P&gt;&lt;P&gt;Fifth, and this is where you may be getting errors, I think: you're calling the&amp;nbsp;&lt;STRONG&gt;SUM&amp;nbsp;&lt;/STRONG&gt;function on individual features, but the function is expecting a FeatureSet, an array, or a list. Calling it on a feature won't work. Also, you're already summing this field in your GroupBy functions. You can replace this with the name of the attribute you created in the GroupBy statement.&lt;/P&gt;&lt;PRE&gt;count_of_found: p['CatCode28_poly']&lt;/PRE&gt;&lt;P&gt;If you're trying to get a per-type sum, keep in mind that once your data expression comes into the dashboard, many of the dashboard's own widgets can handle additional grouping and aggregating for you.&lt;/P&gt;&lt;P&gt;Finally, and this could also be the source of the error, your feature&amp;nbsp;&lt;STRONG&gt;attributes&lt;/STRONG&gt; objects don't match the&amp;nbsp;&lt;STRONG&gt;fields&lt;/STRONG&gt; in your combinedDict. If your combinedDict has fields&amp;nbsp;&lt;STRONG&gt;CatCode28&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;count_of_found&lt;/STRONG&gt;, then you must have corresponding attributes in your features, otherwise these fields will be null. If you really want your "type" attributes to come through in the output, you need a field for that, too.&lt;/P&gt;&lt;P&gt;It's hard to know exactly how to re-write this without more information about the data and what exactly you're envisioning to come out of it, but here's a version of your expression with some of these changes in place.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('PORTAL_URL');

var pt = GroupBy(
    FeatureSetByPortalItem(
        portal,
        'FEATURE_ID',
        0,
        ['RBU','CatCode28'],
        false
    ),
    'RBU',
    {
        name: 'CatCode28_point',
        expression: 'Point_CatCode28',
        statistic: 'SUM'
    }
);

var ln = GroupBy(
    FeatureSetByPortalItem(
        portal,
        'eba1d0d180a0419499566e4aa1336eea',
        0,
        ['RBU','CatCode28'],
        false
    ),
    'RBU',
    {
        name: 'CatCode28_line',
        expression: 'Line_CatCode28',
        statistic: 'SUM'
    }
);

var poly = GroupBy(
    FeatureSetByPortalItem(
        portal,
        '111b954c606045e18180d507fcc40aef',
        0,
        ['RBU','CatCode28'],
        false
    ),
    'RBU',
    {
        name: 'CatCode28_poly',
        expression: 'Poly_CatCode28',
        statistic: 'SUM'
    }
);


// Create empty array for features, feat object to populate array
var features = [];
var feat;

// Loop through each of the three FeatureSets and populate feature array.
for (var p in point) {
    feat = {
        attributes: {
            geom_type: 'Points',
            RBU: p['RBU'],
            count_of_found: p['CatCode28_point']
        },
    };
    
    Push(features, feat);
}

for (var l in line) {
    feat = {
        attributes: {
            geom_type: 'Line',
            RBU: l['RBU'],
            count_of_found: l['CatCode28_line']
        }
    };
    
    Push(features, feat);
}

for (var g in polygon) {
    feat = {
        attributes: {
            geom_type: 'Polygon',
            RBU: g['RBU'],
            count_of_found: g['CatCode28_poly'],
        }
    };
    
    Push(features, feat);
};

var combinedDict = {
    fields: [
        {name: 'geom_type', type: 'esriFieldTypeString'},
        {name: 'RBU', type: 'esriFieldTypeString' },
        {name: 'count_of_found', type: 'esriFieldTypeInteger' }
    ],
    geometryType: '',
    features: features
};

// Return dictionary cast as a feature set
return FeatureSet(Text(combinedDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 22:19:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1238942#M7070</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-12-07T22:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Arcade Group Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1239436#M7078</link>
      <description>&lt;P&gt;Hi Josh,&lt;/P&gt;&lt;P&gt;Thanks for the quick response. Looking over your comments it is clear to me that I do not know what I am doing and copy and pasting my attributes into an existing code did not do the trick. My goal is to combine my three asset features (point, line, polygon) into one table. I would like to sum the CatCode28 (found/ not found) attribute in each feature and separate the total sums by RBU (responsible business unit). Essentially I want to know how many assets from each RBU within my three features have been found or not found (CatCode28), then present the data in a serial chart (bar graph) within dashboard for the RBU managers. Hopefully that sheds some light on what I am trying to do. I have attempted to touch up the code with the guidance you gave but at a certain point I am just blindingly trying things with no idea what I am doing. Hopefully my explanation will give you more to work with. I really appreciate the help.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 22:06:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1239436#M7078</guid>
      <dc:creator>Michael_VanHatten</dc:creator>
      <dc:date>2022-12-08T22:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Arcade Group Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1239621#M7079</link>
      <description>&lt;P&gt;So, when you say "sum the CatCode28 attribute in each feature", what does that mean? How can you sum a single attribute inside of a single feature? Do you mean you want to sum it by feature type? Or sum all the features by CatCode?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 14:11:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1239621#M7079</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-12-09T14:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Arcade Group Layers</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1239693#M7080</link>
      <description>&lt;P&gt;Now that you ask that I realize that the sum of those attributes might not be what I need. A count of the the different types of CatCode28 is really what I need. I want to display how many assets in pt, line and polygon, have been Found or Not found, which is represented in the CatCode28 attribute as text. Then filter the data for all three layers by RBU.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 16:24:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-arcade-group-layers/m-p/1239693#M7080</guid>
      <dc:creator>Michael_VanHatten</dc:creator>
      <dc:date>2022-12-09T16:24:05Z</dc:date>
    </item>
  </channel>
</rss>

