<?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 Create serial chart using FeatureSetbyPortalItem Arcade function in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244792#M7157</link>
    <description>&lt;P&gt;Using Dashboards I'm trying to create a serial chart that shows total count of features within each layer with the layer name on x-axis and count on y-axis. The individual layers come from the same hosted feature layer which is why the itemId is the same for each layer&lt;/P&gt;&lt;LI-CODE lang="java"&gt;// Access organization's ArcGIS Online URL
var portal = Portal("https.blank.maps.arcgis.com");

// Access each layer item as a feature set from the portal
var waterLine = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var sanLine = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var roads = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var waterPoly = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var sanPoly = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var other = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var building = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var bridge = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var boardwalk = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)

var totalCount = Count(waterLine) + Count(sanLine) + Count(roads) + Count(waterPoly) + 
Count(sanPoly) + Count(other) + Count(building) + Count(bridge) + Count(boardwalk)

var Dict = {
	fields: [{name: 'total', type: 'esriFieldTypeInteger'}], 
	geometryType: '',
	features: [{attributes: {total: totalCount}}],
};
	
//Return dictionary cast as a feature set
return FeatureSet(Text(Dict));&lt;/LI-CODE&gt;&lt;P&gt;Any help would be much appreciated, I'm very new to Arcade.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2023 05:20:33 GMT</pubDate>
    <dc:creator>KhadijaSafi</dc:creator>
    <dc:date>2023-01-03T05:20:33Z</dc:date>
    <item>
      <title>Create serial chart using FeatureSetbyPortalItem Arcade function</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244792#M7157</link>
      <description>&lt;P&gt;Using Dashboards I'm trying to create a serial chart that shows total count of features within each layer with the layer name on x-axis and count on y-axis. The individual layers come from the same hosted feature layer which is why the itemId is the same for each layer&lt;/P&gt;&lt;LI-CODE lang="java"&gt;// Access organization's ArcGIS Online URL
var portal = Portal("https.blank.maps.arcgis.com");

// Access each layer item as a feature set from the portal
var waterLine = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var sanLine = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var roads = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var waterPoly = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var sanPoly = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var other = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var building = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var bridge = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)
var boardwalk = FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false)

var totalCount = Count(waterLine) + Count(sanLine) + Count(roads) + Count(waterPoly) + 
Count(sanPoly) + Count(other) + Count(building) + Count(bridge) + Count(boardwalk)

var Dict = {
	fields: [{name: 'total', type: 'esriFieldTypeInteger'}], 
	geometryType: '',
	features: [{attributes: {total: totalCount}}],
};
	
//Return dictionary cast as a feature set
return FeatureSet(Text(Dict));&lt;/LI-CODE&gt;&lt;P&gt;Any help would be much appreciated, I'm very new to Arcade.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 05:20:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244792#M7157</guid>
      <dc:creator>KhadijaSafi</dc:creator>
      <dc:date>2023-01-03T05:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create serial chart using FeatureSetbyPortalItem Arcade function</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244878#M7159</link>
      <description>&lt;P&gt;When you attempt to use this code, what kind of response do you get? I don't see any obvious errors in your code.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 14:33:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244878#M7159</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-01-03T14:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create serial chart using FeatureSetbyPortalItem Arcade function</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244893#M7160</link>
      <description>&lt;P&gt;I think you're very close!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Couple of things to check/try&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;portal&amp;nbsp;&lt;/EM&gt;is a reserved keyword, change it to another string to remove that as an issue, for example&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portalItem = Portal("https://blank.maps.arcgis.com");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Check your URL is in the correct format, the format in the code isn't ri&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var Dict = {
	fields: [{name: 'total', type: 'esriFieldTypeInteger'}, {name: 'layername', type: 'esriFieldTypeString'}], 
	geometryType: '',
	features: [{attributes: {total: totalCount, layername: "bridge"}}],
};
	​&lt;/LI-CODE&gt;&lt;P&gt;ght but might just have been from you swapping out your specific URL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The Dict you're building needs to include layer name element if you want to display the layer name on the chart&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var Dict = {
	fields: [{name: 'total', type: 'esriFieldTypeInteger'}, {name: 'layername', type: 'esriFieldTypeString'}], 
	geometryType: '',
	features: [{attributes: {total: totalCount, layername: "bridge"}}],
};
	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Dict your building is based upon 9 layers, but these are all the same layers. Are 'building', 'bridge' etc sub layers in the&amp;nbsp;51dc078a4b35479fb975114ca4abf546 item or attributes in the 0 sub layer? If it's the latter, you may want to filter so you're getting counts of the individual categories, instead of the layer as a whole, for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var building = Filter(FeatureSetByPortalItem(portal, "51dc078a4b35479fb975114ca4abf546", 0, ["*"], false), "fieldName = 'building'");​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The Dict your building is just returning one feature, and one total count, not the individual counts of each layer. Consider adding more features to your Dict&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Dict = {
	fields: [{name: 'total', type: 'esriFieldTypeInteger'}, {name: 'layername', type: 'esriFieldTypeString'}], 
	geometryType: '',
	features: [{attributes: {total: totalCount, layername: "bridge"}, {total: totalCount, layername: "building"}}],
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 14:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/create-serial-chart-using-featuresetbyportalitem/m-p/1244893#M7160</guid>
      <dc:creator>CarmelConnolly</dc:creator>
      <dc:date>2023-01-03T14:55:27Z</dc:date>
    </item>
  </channel>
</rss>

