<?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 - Show fields without doing calculations in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290779#M7850</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341" target="_blank"&gt;@JohannesLindner&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying a Test execution error and I'm trying to fix it but It hasn't worked yet.&amp;nbsp; I'm wondering if it has to to something at this location. Can you please let me know if I'm in the right track ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hashem_0-1684435482644.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71106i3E112D46EBF7D42F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hashem_0-1684435482644.png" alt="Hashem_0-1684435482644.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the schema of my data below where the field name that needs to be added is called 'Variant_Name'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hashem_1-1684435482662.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71107i2CD8AAFC610996D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hashem_1-1684435482662.png" alt="Hashem_1-1684435482662.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 May 2023 18:44:54 GMT</pubDate>
    <dc:creator>Hashem</dc:creator>
    <dc:date>2023-05-18T18:44:54Z</dc:date>
    <item>
      <title>Arcade - Show fields without doing calculations</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290216#M7838</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m trying to create a table using Arcade that only shows the highest frequency read for each [Sample Date, Site ID] but while also showing the ‘variant_name’ field in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hashem_0-1684344974029.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/70964iE9E820C865B77E97/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hashem_0-1684344974029.png" alt="Hashem_0-1684344974029.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to create something like this but I don’t know how to integrate “Variant_name” in the arcade code below because I’m not using it for any calculations. Can you let me know how to proceed ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like it got the job done but I need to integrate “Variant_name” I just don’t know where to put it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hashem_1-1684344974032.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/70963iF25B920BBB052B39/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hashem_1-1684344974032.png" alt="Hashem_1-1684344974032.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code used:&l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gt;&lt;SPAN&gt;],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[{&lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'Estimated_Frequency_Reads'&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;expression&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'Estimated_Frequency_Reads'&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;statistic&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'MAX'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;}] );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I feel like&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341" target="_blank" rel="noopener"&gt;@JohannesLindner&lt;/A&gt;&amp;nbsp;would be great with this&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 17:38:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290216#M7838</guid>
      <dc:creator>Hashem</dc:creator>
      <dc:date>2023-05-17T17:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Show fields without doing calculations</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290279#M7842</link>
      <description>&lt;P&gt;Just answered on the Idea you posted. Ideas are for improvements you want to propose. Let's talk about this question here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to join the Variant field to the grouped Featureset. There is no native function to join a field, so you have to do it yourself:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// group by date and site, getting the max frequency
var grouped_fs = GroupBy(fs, ['Sample_Date', 'Site_ID'], [{name: 'Estimated_Frequency_Reads', expression: 'Estimated_Frequency_Reads', statistic: 'MAX' }] )

// create an empty featureset for the join with variant
var join_fields = [
  {name: "Variant", type: "esriFieldTypeString"}
]
var out_fs = {
  geometryType: "",
  fields: Splice(Schema(grouped_fs).fields, join_fields),
  features: []
}

// join with the original fs to get the variant
for(var f in grouped_fs) {
  var d = f.Sample_Date
  var s = f.Site_ID
  var f = f.Estimated_Frequency_Reads
  var join = First(Filter(fs, "Sample_Date = @d AND Site_ID = @s AND Estimated_Frequency_Reads = @f"))
  Push(out_fs.features, {attributes:{Sample_Date: Number(d), Site_ID: s, Estimated_Frequency_Reads: f, Variant: join.Variant}})
}
return Featureset(Text(out_fs))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This expression uses Filter() in a loop, which isn't very performant. If the expression is slow, copy the Memorize() function from &lt;A href="https://community.esri.com/t5/arcgis-online-blog/improving-expression-performance-a-custom-function/ba-p/1288785/jump-to/first-unread-message" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt; and apply it to your Featureset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = Memorize(FeaturesetByPortalItem(...))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 18:40:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290279#M7842</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-05-17T18:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Show fields without doing calculations</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290779#M7850</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341" target="_blank"&gt;@JohannesLindner&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying a Test execution error and I'm trying to fix it but It hasn't worked yet.&amp;nbsp; I'm wondering if it has to to something at this location. Can you please let me know if I'm in the right track ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hashem_0-1684435482644.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71106i3E112D46EBF7D42F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hashem_0-1684435482644.png" alt="Hashem_0-1684435482644.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the schema of my data below where the field name that needs to be added is called 'Variant_Name'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hashem_1-1684435482662.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71107i2CD8AAFC610996D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hashem_1-1684435482662.png" alt="Hashem_1-1684435482662.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 18:44:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290779#M7850</guid>
      <dc:creator>Hashem</dc:creator>
      <dc:date>2023-05-18T18:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Show fields without doing calculations</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290980#M7851</link>
      <description>&lt;P&gt;Possible error sources:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Your field name "Variant_Name" is different from what I used in my test data ("Variant"). Replace every "Variant" with "Variant_Name".&lt;/LI&gt;&lt;LI&gt;I messed up and used the same variable name "f" for both the Feature and the frequency.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// group by date and site, getting the max frequency
var grouped_fs = GroupBy(fs, ['Sample_Date','Site_ID'], [{name: 'Estimated_Frequency_Reads', expression: 'Estimated_Frequency_Reads', statistic: 'MAX' }] )

// create an ampty featureset for the join with variant
var join_fields = [
  {name: "Variant_Name", type: "esriFieldTypeString"}
]
var out_fs = {
  geometryType: "",
  fields: Splice(Schema(grouped_fs).fields, join_fields),
  features: []
}

// join with the original fs to get the variant
for(var f in grouped_fs) {
  var d = f.Sample_Date
  var s = f.Site_ID
  var freq = f.Estimated_Frequency_Reads
  var join = First(Filter(fs, "Sample_Date = @d AND Site_ID = @s AND Estimated_Frequency_Reads = @freq"))
  Push(out_fs.features, {attributes:{Sample_Date: Number(d), Site_ID: s, Estimated_Frequency_Reads: freq, Variant_Name: join.Variant_Name}})
}
return Featureset(Text(out_fs))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that still doesn't work, I'd need access to your actual data.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 10:58:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-show-fields-without-doing-calculations/m-p/1290980#M7851</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-05-19T10:58:52Z</dc:date>
    </item>
  </channel>
</rss>

