<?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 Dictionary to FeatureSet issues. Probably the dictionary format? in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552233#M10424</link>
    <description>&lt;P&gt;I'm struggling to work out what I'm doing wrong trying to convert this Dictionary to a FeatureSet. I'm getting an invalid parameter error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(
    portal,
    id,
    0,
    fields,
    False
)

var combinedFeatures = [];

for (var f in fs) {
        Push(combinedFeatures, {
            "Variety": f["variety1"],
            "Area": f["var1_perc"]
        });
        Push(combinedFeatures, {
            "Variety": f["variety2"],
            "Area": f["var2_perc"]
        });
        Push(combinedFeatures, {
            "Variety": f["variety3"],
            "Area": f["var3_perc"]
        });
};

var schema = { fields: [
    { name: "Variety", type: "esriFieldTypeString" },
    { name: "Area", type: "esriFieldTypeSmallInteger" }
]};

var d = Dictionary(Text(combinedFeatures, schema));

Console(d)

return FeatureSet(d)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dictionary, as shown by Console(), looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"0":{"Variety":null,"Area":0},"1":{"Variety":null,"Area":0},"2":{"Variety":null,"Area":0},"3":{"Variety":null,"Area":0},"4":{"Variety":null,"Area":0},"5":{"Variety":null,"Area":0},"6":{"Variety":null,"Area":0},"7":{"Variety":null,"Area":0},"8":{"Variety":null,"Area":0},"9":{"Variety":null,"Area":0},"10":{"Variety":null,"Area":0},"11":{"Variety":null,"Area":0},"12":{"Variety":null,"Area":0},..............&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2024 07:49:22 GMT</pubDate>
    <dc:creator>BlakeMorrison</dc:creator>
    <dc:date>2024-10-25T07:49:22Z</dc:date>
    <item>
      <title>Dictionary to FeatureSet issues. Probably the dictionary format?</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552233#M10424</link>
      <description>&lt;P&gt;I'm struggling to work out what I'm doing wrong trying to convert this Dictionary to a FeatureSet. I'm getting an invalid parameter error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(
    portal,
    id,
    0,
    fields,
    False
)

var combinedFeatures = [];

for (var f in fs) {
        Push(combinedFeatures, {
            "Variety": f["variety1"],
            "Area": f["var1_perc"]
        });
        Push(combinedFeatures, {
            "Variety": f["variety2"],
            "Area": f["var2_perc"]
        });
        Push(combinedFeatures, {
            "Variety": f["variety3"],
            "Area": f["var3_perc"]
        });
};

var schema = { fields: [
    { name: "Variety", type: "esriFieldTypeString" },
    { name: "Area", type: "esriFieldTypeSmallInteger" }
]};

var d = Dictionary(Text(combinedFeatures, schema));

Console(d)

return FeatureSet(d)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dictionary, as shown by Console(), looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"0":{"Variety":null,"Area":0},"1":{"Variety":null,"Area":0},"2":{"Variety":null,"Area":0},"3":{"Variety":null,"Area":0},"4":{"Variety":null,"Area":0},"5":{"Variety":null,"Area":0},"6":{"Variety":null,"Area":0},"7":{"Variety":null,"Area":0},"8":{"Variety":null,"Area":0},"9":{"Variety":null,"Area":0},"10":{"Variety":null,"Area":0},"11":{"Variety":null,"Area":0},"12":{"Variety":null,"Area":0},..............&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 07:49:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552233#M10424</guid>
      <dc:creator>BlakeMorrison</dc:creator>
      <dc:date>2024-10-25T07:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dictionary to FeatureSet issues. Probably the dictionary format?</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552373#M10425</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/708431"&gt;@BlakeMorrison&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you try replacing your var d with this here and then console/return it:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var featureSet = FeatureSet(Text(combinedFeatures), schema);&lt;/LI-CODE&gt;&lt;P&gt;I'm wondering if there is a difference between the dictionary and its current formatting, and the creation of the FeatureSet, as schema looks properly placed together, but combinedFeatures may need moved to Text.&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 14:53:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552373#M10425</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-10-25T14:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dictionary to FeatureSet issues. Probably the dictionary format?</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552468#M10426</link>
      <description>&lt;P&gt;I believe what you're trying to do would be like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(
    portal,
    id,
    0,
    fields,
    False
)

var combinedFeatures = [];

for (var f in fs) {
  Push(
    combinedFeatures,
    { attributes: { Variety: f["variety1"], Area: f["var1_perc"] } }
  );
  Push(
    combinedFeatures,
    { attributes: { Variety: f["variety2"], Area: f["var2_perc"] } }
  );
  Push(
    combinedFeatures,
    { attributes: { Variety: f["variety3"], Area: f["var3_perc"] } }
  );
}

var combinedDict = {
  fields: [
    { name: "Variety", type: "esriFieldTypeString" },
    { name: "Area", type: "esriFieldTypeInteger" }
  ],
  geometryType: "",
  features: combinedFeatures
};

var d = Dictionary(combinedDict);

Console(d);

return FeatureSet(d);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 17:44:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dictionary-to-featureset-issues-probably-the/m-p/1552468#M10426</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-10-25T17:44:52Z</dc:date>
    </item>
  </channel>
</rss>

