<?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 Data expression does not always execute properly in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-does-not-always-execute-properly/m-p/1060401#M4563</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a data expression (below) which executed properly when I was testing the data expression and configuring my chart in my Dashboard. After I saved and refreshed, it was no longer executing properly and does not show all of the data. Sometimes all data is returned, and other times it is not.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example, this is what the chart should look like &lt;/STRONG&gt;(&lt;EM&gt;it does look like this sometimes&lt;/EM&gt;)&lt;STRONG&gt;:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erica_tefft_0-1621604713755.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13873i26C4EF856DB75772/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erica_tefft_0-1621604713755.png" alt="erica_tefft_0-1621604713755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then if I refresh, I see this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erica_tefft_1-1621604802696.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13874iD24E58040403709D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erica_tefft_1-1621604802696.png" alt="erica_tefft_1-1621604802696.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my data expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal("https://www.arcgis.com");
// Create a FeatureSet for stable and unstable inspections. 
// Group the features by the BLA 

var BLA = FeatureSetByPortalItem(portal,"###",0,['BLA_Used'],false);

var groupBLA = GroupBy(BLA,
  ["BLA_Used"],
  [
    { name: "BoatLaunchArea", expression: "BLA_Used", statistic: "COUNT" },
  ]
);

var combinedDict = {
  fields: [
    { name: "BLA", type: "esriFieldTypeString" },
    { name: "cntSurveyScans", type: "esriFieldTypeInteger" },
  ],
  geometryType: "",
  features: [],
};

var i = 0;

for (var m in groupBLA) {
  combinedDict.features[i] = {
    attributes: {
      BLA: m["BLA_Used"],
      cntSurveyScans: (m["BoatLaunchArea"] / 2),
    },
  };
  i++;
}

return FeatureSet(Text(combinedDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This feature layer is updated frequently by Survey123. Could the frequent updates to the layer be causing these issues?&amp;nbsp; This layer also has 8,000 records and counting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be appreciated!&lt;/P&gt;&lt;P&gt;Erica&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 May 2021 13:48:32 GMT</pubDate>
    <dc:creator>erica_poisson</dc:creator>
    <dc:date>2021-05-21T13:48:32Z</dc:date>
    <item>
      <title>Data expression does not always execute properly</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-does-not-always-execute-properly/m-p/1060401#M4563</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a data expression (below) which executed properly when I was testing the data expression and configuring my chart in my Dashboard. After I saved and refreshed, it was no longer executing properly and does not show all of the data. Sometimes all data is returned, and other times it is not.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example, this is what the chart should look like &lt;/STRONG&gt;(&lt;EM&gt;it does look like this sometimes&lt;/EM&gt;)&lt;STRONG&gt;:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erica_tefft_0-1621604713755.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13873i26C4EF856DB75772/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erica_tefft_0-1621604713755.png" alt="erica_tefft_0-1621604713755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then if I refresh, I see this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erica_tefft_1-1621604802696.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13874iD24E58040403709D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erica_tefft_1-1621604802696.png" alt="erica_tefft_1-1621604802696.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my data expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal("https://www.arcgis.com");
// Create a FeatureSet for stable and unstable inspections. 
// Group the features by the BLA 

var BLA = FeatureSetByPortalItem(portal,"###",0,['BLA_Used'],false);

var groupBLA = GroupBy(BLA,
  ["BLA_Used"],
  [
    { name: "BoatLaunchArea", expression: "BLA_Used", statistic: "COUNT" },
  ]
);

var combinedDict = {
  fields: [
    { name: "BLA", type: "esriFieldTypeString" },
    { name: "cntSurveyScans", type: "esriFieldTypeInteger" },
  ],
  geometryType: "",
  features: [],
};

var i = 0;

for (var m in groupBLA) {
  combinedDict.features[i] = {
    attributes: {
      BLA: m["BLA_Used"],
      cntSurveyScans: (m["BoatLaunchArea"] / 2),
    },
  };
  i++;
}

return FeatureSet(Text(combinedDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This feature layer is updated frequently by Survey123. Could the frequent updates to the layer be causing these issues?&amp;nbsp; This layer also has 8,000 records and counting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be appreciated!&lt;/P&gt;&lt;P&gt;Erica&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 13:48:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-does-not-always-execute-properly/m-p/1060401#M4563</guid>
      <dc:creator>erica_poisson</dc:creator>
      <dc:date>2021-05-21T13:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression does not always execute properly</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-does-not-always-execute-properly/m-p/1061959#M4588</link>
      <description>&lt;P&gt;I figured this out - the occasional decimal value was messing this up. The correct data expression now reads:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal("https://www.arcgis.com");
// Group the features by the BLA 

var BLA = FeatureSetByPortalItem(portal,"xxx",0,['BLA_Used'],false);

var groupBLA = GroupBy(BLA,
  ["BLA_Used"],
  [
    { name: "BoatLaunchArea", expression: "BLA_Used", statistic: "COUNT" },
  ]
);

var combinedDict = {
  fields: [
    { name: "BLA", type: "esriFieldTypeString" },
    { name: "cntSurveyScans", type: "esriFieldTypeInteger" },
  ],
  geometryType: "",
  features: [],
};

var i = 0;

for (var m in groupBLA) {
  combinedDict.features[i] = {
    attributes: {
      BLA: m["BLA_Used"],
      cntSurveyScans: (Floor(m["BoatLaunchArea"] / 2)),
    },
  };
  i++;
}

return FeatureSet(Text(combinedDict));&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 May 2021 18:29:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-does-not-always-execute-properly/m-p/1061959#M4588</guid>
      <dc:creator>erica_poisson</dc:creator>
      <dc:date>2021-05-26T18:29:17Z</dc:date>
    </item>
  </channel>
</rss>

