<?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: Arcade expression, FeatureSet() parameter error in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1129023#M5569</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 27 Dec 2021 19:09:29 GMT</pubDate>
    <dc:creator>JGardner_Verina</dc:creator>
    <dc:date>2021-12-27T19:09:29Z</dc:date>
    <item>
      <title>Arcade expression, FeatureSet() parameter error</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1128992#M5567</link>
      <description>&lt;P&gt;I am attempting to build an expression in ArcGIS dashboards that will return a few basic summary statistics. It draws from two related Survey123 features.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var fs01 = FeatureSetByPortalItem(Portal('https://arcgis.com/'), 'id', 0, ['*'], false);
var fs02 = FeatureSetByPortalItem(Portal('https://arcgis.com/'), 'id', 1, ['*'], false);

var deliveriesDict = {
						'deliveries': COUNT(fs01),
						'totalTanks': COUNT(fs02),
						'totalFuel': SUM(fs02, 'fuelFilled')
					}


return FeatureSet(Text(deliveriesDict));&lt;/LI-CODE&gt;&lt;P&gt;This code returns the error "Invalid parameter." When I have it return only the dictionary and test it, it returns the expected result. I know I need to return a FeatureSet in order for the expression to work in Dashboards, but the FeatureSet() function doesn't like my parameter. I have also tried the following, with the same invalid parameter error:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var fs01 = FeatureSetByPortalItem(Portal('https://arcgis.com/'), 'id', 0, ['*'], false);
var fs02 = FeatureSetByPortalItem(Portal('https://arcgis.com/'), 'id', 1, ['*'], false);

var deliveriesDict = {
						'deliveries': COUNT(fs01),
						'totalTanks': COUNT(fs02),
						'totalFuel': SUM(fs02, 'fuelFilled')
					}
var textDict = TEXT(deliveriesDict);
var fs_dict = FeatureSet(textDict);
return fs_dict;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain what I need to do to get the expression to return a FeatureSet?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 18:12:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1128992#M5567</guid>
      <dc:creator>JGardner_Verina</dc:creator>
      <dc:date>2021-12-27T18:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression, FeatureSet() parameter error</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1129014#M5568</link>
      <description>&lt;P&gt;A featureset is composed of more than just attributes. What you're defining as your &lt;STRONG&gt;deliveriesDict&lt;/STRONG&gt; makes more sense as a singular feature. The FeatureSet needs to have its geometry type and all fields defined separately from providing data to it.&lt;/P&gt;&lt;P&gt;Essentially, you're getting a one-feature output with the totals in it as attributes. Try:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs01 = FeatureSetByPortalItem(Portal('https://arcgis.com/'), 'id', 0, ['*'], false);
var fs02 = FeatureSetByPortalItem(Portal('https://arcgis.com/'), 'id', 1, ['*'], false);

var deliveriesDict = {
    fields: [
        {name: 'deliveries', type: 'esriFieldTypeInteger'},
        {name: 'totalTanks', type: 'esriFieldTypeInteger'},
        {name: 'totalFuel', type: 'esriFieldTypeInteger'} // or possibly a float if need be
    ],
    geometryType: '',
    features: [
        {attributes: {
            deliveries: Count(fs01),
            totalTanks: Count(fs02),
            totalFuel: Sum(fs02, 'fuelFilled')
            }
        }
    ]
}

return FeatureSet(Text(deliveriesDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 18:55:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1129014#M5568</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-27T18:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression, FeatureSet() parameter error</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1129023#M5569</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 19:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-featureset-parameter-error/m-p/1129023#M5569</guid>
      <dc:creator>JGardner_Verina</dc:creator>
      <dc:date>2021-12-27T19:09:29Z</dc:date>
    </item>
  </channel>
</rss>

