<?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: Help getting a data expression to work. in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1299927#M7953</link>
    <description>&lt;P&gt;With this week's update to Arcade and ArcGIS Dashboards, date fields in feature set constructors now just work. You no longer have to wrap dates with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Number()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if you pass the &lt;EM&gt;dictionary&lt;/EM&gt; into the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FeatureSet()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function (which as of this release accepts a dictionary as opposed to only text based JSON).&lt;/P&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(Text(dict))&lt;/PRE&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(dict)&lt;/PRE&gt;&lt;P&gt;Learn more in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboard-data-expressions-what-has-changed-june/ba-p/1298782" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NOTE: For Enterprise users, this update is targeted for 11.2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 19:19:34 GMT</pubDate>
    <dc:creator>DavidNyenhuis1</dc:creator>
    <dc:date>2023-06-15T19:19:34Z</dc:date>
    <item>
      <title>Help getting a data expression to work.</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1241571#M7111</link>
      <description>&lt;P&gt;I'm writing a data expression to show which polygon (mmz) each point (leaks) resides within.&amp;nbsp; I also need to keep a few fields from the leaks feature.&amp;nbsp; I can populate the 'mmz' field, but I'm having trouble getting the other fields I need.&amp;nbsp; Here's what I have so far and the results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var port = Portal('my portal')&lt;BR /&gt;var mmz = FeatureSetByPortalItem(port, 'c879aa9267604224a3f6d492fc997a50', 7,['ZONE_NAME'],true)&lt;BR /&gt;var leaks = FeatureSetByPortalItem(port, '44fa0f9330e449c289dfadf2553d805b', 0,['leakloss','leaktype','dateshot','leaks_count','material','maindiameter'],true)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;var features = []&lt;BR /&gt;var feat&lt;/P&gt;&lt;P&gt;for (var zone in mmz){&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;var pts = Contains(zone,leaks)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for (var pt in pts){&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;feat = {attributes:{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mmz:&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;zone ['ZONE_NAME'],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;leakloss: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pt ['leakloss'],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;leaktype: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pt ['leaktype'],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dateshot: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pt ['dateshot'],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;leaks_count:&amp;nbsp; &amp;nbsp; &amp;nbsp;pt ['leaks_count'],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;material: &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; pt ['material'],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;maindiameter: pt ['maindiameter']&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;Push(features,feat)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var dict = {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;fields: [&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "mmz", alias:"Zone", type:"esriFieldTypeString"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "leakloss", alias:"Gallons Lost", type:"esriFieldTypeInteger"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "leaks_count", alias:"Number of Leaks", type:"esriFieldTypeInteger"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "leaktype", alias:"Leak Type", type:"esriFieldTypeString"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "dateshot", alias:"Date", type:"esriFieldTypeDate"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "material", alias:"Material", type:"esriFieldTypeString"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {name: "maindiameter", alias:"Diameter", type:"esriFieldTypeInteger"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;geometryType:"",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;features:features&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return FeatureSet(Text(dict))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChelseaTabor_0-1671118894004.png" style="width: 575px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58647iE63AE41C60F25CF1/image-dimensions/575x173?v=v2" width="575" height="173" role="button" title="ChelseaTabor_0-1671118894004.png" alt="ChelseaTabor_0-1671118894004.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 15:47:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1241571#M7111</guid>
      <dc:creator>ChelseaTabor</dc:creator>
      <dc:date>2022-12-15T15:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting a data expression to work.</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1241574#M7113</link>
      <description>&lt;P&gt;I don't really see anything obviously wrong with the expression... You've confirmed the fields in the points layer has values, and that they're compatible with an integer field?&lt;/P&gt;&lt;P&gt;Data Expressions also tend to have trouble with &lt;STRONG&gt;Date &lt;/STRONG&gt;fields. Try replacing this line:&lt;/P&gt;&lt;PRE&gt;dateshot: pt ['dateshot'],&lt;/PRE&gt;&lt;P&gt;with this:&lt;/P&gt;&lt;PRE&gt;dateshot: Number(pt['dateshot']),&lt;/PRE&gt;&lt;P&gt;Also, there are spaces between &lt;STRONG&gt;zone / pt&lt;/STRONG&gt; and the bracketed attribute name, and there shouldn't be.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 15:59:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1241574#M7113</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-12-15T15:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting a data expression to work.</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1241715#M7116</link>
      <description>&lt;P&gt;Adding the Number function to the date field worked, but I also had to add the Text function to string field types for those values to show up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 20:11:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1241715#M7116</guid>
      <dc:creator>ChelseaTabor</dc:creator>
      <dc:date>2022-12-15T20:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting a data expression to work.</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1242021#M7118</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I also had to add the Text function to string field types for those values to show up&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;That's weird, this conversion should happen automagically.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The problem with Date fields is something that leads to confusion quite regularly. Please consider lending your support to this idea to hopefully get that fixed:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-ideas/arcade-allow-date-values-in-date-fields/idi-p/1204894" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://community.esri.com/t5/arcgis-online-ideas/arcade-allow-date-values-in-date-fields/idi-p/1204894&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 15:30:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1242021#M7118</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-16T15:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting a data expression to work.</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1299927#M7953</link>
      <description>&lt;P&gt;With this week's update to Arcade and ArcGIS Dashboards, date fields in feature set constructors now just work. You no longer have to wrap dates with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Number()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if you pass the &lt;EM&gt;dictionary&lt;/EM&gt; into the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FeatureSet()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function (which as of this release accepts a dictionary as opposed to only text based JSON).&lt;/P&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(Text(dict))&lt;/PRE&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(dict)&lt;/PRE&gt;&lt;P&gt;Learn more in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboard-data-expressions-what-has-changed-june/ba-p/1298782" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NOTE: For Enterprise users, this update is targeted for 11.2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 19:19:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/help-getting-a-data-expression-to-work/m-p/1299927#M7953</guid>
      <dc:creator>DavidNyenhuis1</dc:creator>
      <dc:date>2023-06-15T19:19:34Z</dc:date>
    </item>
  </channel>
</rss>

