<?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: execution error  - invalid parameter - JoinLayerFieldsToTable after successful GroupBy in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1370532#M8940</link>
    <description>&lt;P data-unlink="true"&gt;Hi, I am still having issues with this expression. I'd like to join a table to a GroupBy table (polygon feature layer) using &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/JoinLayerFieldsToTable.md" target="_self"&gt;JoinLayerFieldsToTable&lt;/A&gt;. I am&amp;nbsp;able to import the Feature Layer and Table using FeatureSetByPortalItem. I am also able to GroupBy the 'Jurisdiction' column for my feature layer. I am just unsure where I am going wrong with the populate feature array, joining dictionary, and successfully returning the dictionary as a FeatureSet. Please see source code below. Again, I appreciate any helpful insights or solutions. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Write an expression that returns a FeatureSet.
// Documentation: https://arcg.is/3c419TD
// Samples: https://arcg.is/38SEWWz


var portal = Portal("https://marincounty.maps.arcgis.com/");
var polyFs = FeatureSetByPortalItem(portal,"1112f6fa268c48948093050fe0fc0c44",0,["*"],true);

var tablefs = FeatureSetByPortalItem(portal, "1093d97dbe43474b96d09b701d9672a1", 1,["Jurisdiction","Population","ProcurementTarget","uniqueID"],false);

// create grouped table variable
var polyGroup = GroupBy(polyFs,
['Jurisdiction'],
[{name:'SumPotentialCompTons', expression: "PotentialCompTons", statistic: 'SUM'},
{name:'SumPotentialMulchTons', expression: "PotentialMulchTons", statistic: 'SUM'},
{name:'SumPotentialROWPTons', expression: "TotPotentialROWPTons", statistic: 'SUM'}]);

// create empty features
var features = [];
var feat;

// populate feature array
for (var t in tablefs){
  var tableID = t["uniqueID"]
  for (var p in Filter(polyGroup, "Jurisdiction = "+tableID)){
    feat = {
      attributes: {
        FeatureID: tableID,
        Name: p["Jurisdiction"],
        PotCompTons: p["SumPotentialCompTons"],
        PotMulchTons: p["SumPotentialMulchTons"],
        PotROWPTons: p["SumPotentialROWPTons"],
        Population: t["Population"],
        ProcurementTarget: t["ProcurementTarget"],

      }
    }
  Push(features,feat)
  }
}

var joinedDict = {
  fields: [
    { name: "FeatureID", type: "esriFieldTypeInteger" },
    { name: "Name", type: "esriFieldTypeString" },
    { name: "PotCompTons", type: "esriFieldTypeDouble" },
    { name: "PotMulchTons", type: "esriFieldTypeDouble" },
    { name: "PotROWPTons", type: "esriFieldTypeDouble" },
    { name: "Population", type: "esriFieldTypeInteger" },
    { name: "ProcurementTarget", type: "esriFieldTypeDouble" },
  ],
  'geometryType': '',
  'features':features
};

// return dict as feature set
return FeatureSet(joinedDict);&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2024 16:26:49 GMT</pubDate>
    <dc:creator>ChrisGiamarino</dc:creator>
    <dc:date>2024-01-16T16:26:49Z</dc:date>
    <item>
      <title>execution error  - invalid parameter - JoinLayerFieldsToTable after successful GroupBy</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1369876#M8932</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P data-unlink="true"&gt;I have a feature class with 1425 rows and a table with only 10-15 jurisdictions. I am trying to GroupBy the feature class and then JoinLayerFieldsToTable. I've successfully grouped the 1425 rows, but when I try to join them using the &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/JoinLayerFieldsToTable.md" target="_self"&gt;esri arcade GitHub documentation, I get an execution error&lt;/A&gt;.&amp;nbsp;&amp;nbsp;My team and I want to create a bar chart in Dashboards with 5 numerical bars by jurisdiction.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is the code sample:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Write an expression that returns a FeatureSet.
// Documentation: https://arcg.is/3c419TD
// Samples: https://arcg.is/38SEWWz
// Write an expression that returns a FeatureSet.
// Documentation: https://arcg.is/3c419TD
// Samples: https://arcg.is/38SEWWz 
var portal = Portal("https://marincounty.maps.arcgis.com/");
var polyFs = FeatureSetByPortalItem(portal,"1112f6fa268c48948093050fe0fc0c44",0,["*"],true);
var tablefs = FeatureSetByPortalItem(portal,"1093d97dbe43474b96d09b701d9672a1",["*"], 0,false)

// create grouped table variable
var polyGroup = GroupBy(polyFs,
['Jurisdiction'],
[{name:'SumPotentialCompTons', expression: "PotentialCompTons", statistic: 'SUM'},
{name:'SumPotentialMulchTons', expression: "PotentialMulchTons", statistic: 'SUM'},
{name:'SumPotentialROWPTons', expression: "TotPotentialROWPTons", statistic: 'SUM'}]);

var features = [];
var feat;

// Populate Feature Array
for (var t in tablefs) {
    var tableID = t["Jurisdiction"]
    for (var p in Filter(polyGroup, "Jurisdiction = '${tableID}'")){
        feat = {
            attributes: {
                FeatureID: tableID,
                Name: p["Jurisdiction"],
                SumPotentialCompTons: p["SumPotentialCompTons"],
                SumPotentialMulchTons: p["SumPotentialMulchTons"],
                SumPotentialROWPTons: p["SumPotentialROWPTons"],
                Population: t["Population"],
                ProcurementTarget: t["ProcurementTarget"],
				
            }
        }

    Push(features, feat)
    }
}
Console(p)
var joinedDict = {
    fields: [
        { name: "FeatureID", type: "esriFieldTypeString" },
        { name: "Name", type: "esriFieldTypeString" },	
        { name: "SumPotentialCompTons", type: "esriFieldTypeDouble" },
        { name: "SumPotentialMulchTons", type: "esriFieldTypeDouble" },
        { name: "SumPotentialROWPTons", type: "esriFieldTypeDouble" },
        {name: "Population", type: "esriFieldTypeInteger"},
        { name: "ProcurementTarget", type: "esriFieldTypeDouble" },
    ],
    'geometryType': '',
    'features':features
};

// Return dictionary cast as a feature set 
return FeatureSet(joinedDict);


&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone help me troubleshoot and resolve the issue? I'd really appreciate it. We have each jurisdiction populating the feature class with field maps, so we don't want to hard code the population and procurement target values. I am unfamiliar with Console() or seeing logs as to what is happening.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 01:12:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1369876#M8932</guid>
      <dc:creator>ChrisGiamarino</dc:creator>
      <dc:date>2024-01-13T01:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: execution error  - invalid parameter - JoinLayerFieldsToTable after successful GroupBy</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1370532#M8940</link>
      <description>&lt;P data-unlink="true"&gt;Hi, I am still having issues with this expression. I'd like to join a table to a GroupBy table (polygon feature layer) using &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/JoinLayerFieldsToTable.md" target="_self"&gt;JoinLayerFieldsToTable&lt;/A&gt;. I am&amp;nbsp;able to import the Feature Layer and Table using FeatureSetByPortalItem. I am also able to GroupBy the 'Jurisdiction' column for my feature layer. I am just unsure where I am going wrong with the populate feature array, joining dictionary, and successfully returning the dictionary as a FeatureSet. Please see source code below. Again, I appreciate any helpful insights or solutions. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Write an expression that returns a FeatureSet.
// Documentation: https://arcg.is/3c419TD
// Samples: https://arcg.is/38SEWWz


var portal = Portal("https://marincounty.maps.arcgis.com/");
var polyFs = FeatureSetByPortalItem(portal,"1112f6fa268c48948093050fe0fc0c44",0,["*"],true);

var tablefs = FeatureSetByPortalItem(portal, "1093d97dbe43474b96d09b701d9672a1", 1,["Jurisdiction","Population","ProcurementTarget","uniqueID"],false);

// create grouped table variable
var polyGroup = GroupBy(polyFs,
['Jurisdiction'],
[{name:'SumPotentialCompTons', expression: "PotentialCompTons", statistic: 'SUM'},
{name:'SumPotentialMulchTons', expression: "PotentialMulchTons", statistic: 'SUM'},
{name:'SumPotentialROWPTons', expression: "TotPotentialROWPTons", statistic: 'SUM'}]);

// create empty features
var features = [];
var feat;

// populate feature array
for (var t in tablefs){
  var tableID = t["uniqueID"]
  for (var p in Filter(polyGroup, "Jurisdiction = "+tableID)){
    feat = {
      attributes: {
        FeatureID: tableID,
        Name: p["Jurisdiction"],
        PotCompTons: p["SumPotentialCompTons"],
        PotMulchTons: p["SumPotentialMulchTons"],
        PotROWPTons: p["SumPotentialROWPTons"],
        Population: t["Population"],
        ProcurementTarget: t["ProcurementTarget"],

      }
    }
  Push(features,feat)
  }
}

var joinedDict = {
  fields: [
    { name: "FeatureID", type: "esriFieldTypeInteger" },
    { name: "Name", type: "esriFieldTypeString" },
    { name: "PotCompTons", type: "esriFieldTypeDouble" },
    { name: "PotMulchTons", type: "esriFieldTypeDouble" },
    { name: "PotROWPTons", type: "esriFieldTypeDouble" },
    { name: "Population", type: "esriFieldTypeInteger" },
    { name: "ProcurementTarget", type: "esriFieldTypeDouble" },
  ],
  'geometryType': '',
  'features':features
};

// return dict as feature set
return FeatureSet(joinedDict);&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 16:26:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1370532#M8940</guid>
      <dc:creator>ChrisGiamarino</dc:creator>
      <dc:date>2024-01-16T16:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: execution error  - invalid parameter - JoinLayerFieldsToTable after successful GroupBy</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1370581#M8941</link>
      <description>&lt;P&gt;nevermind, after some troubleshooting and referencing this &lt;A href="https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-operations-dashboard-arcade-join-table/td-p/1130352" target="_self"&gt;solution response post&lt;/A&gt; from&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;, I got my code to work. Here is the solution:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Write an expression that returns a FeatureSet.
// Documentation: https://arcg.is/3c419TD
// Samples: https://arcg.is/38SEWWz


var portal = Portal("https://marincounty.maps.arcgis.com/");
var polyFs = FeatureSetByPortalItem(portal,"1112f6fa268c48948093050fe0fc0c44",0,["*"],true);

var tablefs = FeatureSetByPortalItem(portal, "1093d97dbe43474b96d09b701d9672a1", 1,["Jurisdiction","Population","ProcurementTarget","uniqueID"],false);
// return(tablefs)


// create grouped table variable
var polyGroup = GroupBy(polyFs,
['Jurisdiction'],
[{name:'SumPotentialCompTons', expression: "PotentialCompTons", statistic: 'SUM'},
{name:'SumPotentialMulchTons', expression: "PotentialMulchTons", statistic: 'SUM'},
{name:'SumPotentialROWPTons', expression: "TotPotentialROWPTons", statistic: 'SUM'}]);



// create empty features
var features = [];
var feat;

// populate feature array
for (var t in tablefs){
  var tableID = t["Jurisdiction"]
  for (var p in Filter(polyGroup, "Jurisdiction = @tableID")){
    feat = {
      attributes: {
        FeatureID: tableID,
        Name: p["Jurisdiction"],
        PotCompTons: p["SumPotentialCompTons"],
        PotMulchTons: p["SumPotentialMulchTons"],
        PotROWPTons: p["SumPotentialROWPTons"],
        Population: t["Population"],
        ProcurementTarget: t["ProcurementTarget"],
        TargetRemaining: Round((t["ProcurementTarget"] - p["SumPotentialROWPTons"]),2),

      }
    }
  Push(features,feat)
  }
}

var joinedDict = {
  fields: [
    { name: "FeatureID", type: "esriFieldTypeInteger" },
    { name: "Name", type: "esriFieldTypeString" },
    { name: "PotCompTons", type: "esriFieldTypeDouble" },
    { name: "PotMulchTons", type: "esriFieldTypeDouble" },
    { name: "PotROWPTons", type: "esriFieldTypeDouble" },
    { name: "Population", type: "esriFieldTypeInteger" },
    { name: "ProcurementTarget", type: "esriFieldTypeDouble" },
    { name: "TargetRemaining", type: "esriFieldTypeDouble" },
  ],
  'geometryType': '',
  'features':features
};

// return dict as feature set
return FeatureSet(Text(joinedDict));&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 16 Jan 2024 17:18:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/execution-error-invalid-parameter/m-p/1370581#M8941</guid>
      <dc:creator>ChrisGiamarino</dc:creator>
      <dc:date>2024-01-16T17:18:33Z</dc:date>
    </item>
  </channel>
</rss>

