<?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: Need help with Arcade Data Expression in Dashboard in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1266065#M50793</link>
    <description>&lt;P&gt;That works perfectly, thank you so much!! I really appreciate the help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2023 17:07:33 GMT</pubDate>
    <dc:creator>M_M</dc:creator>
    <dc:date>2023-03-09T17:07:33Z</dc:date>
    <item>
      <title>Need help with Arcade Data Expression in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1265881#M50775</link>
      <description>&lt;P&gt;I am new to Arcade and have found myself stuck.&amp;nbsp; I am writing a data expression for dashboard and I can't figure out how to write a calculation.&amp;nbsp; I get an error with everything I've tried.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I need to multiply the Tally field for records with a 'Plot_Size' of 0.02 by 50, and multiply any records with a 'Plot_Size' of 0.01 by 100.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I created a filter to parse out records with 'Plot_Size' 0.02 &amp;amp; 0.01.&amp;nbsp; I tried to create a new var plot_exp to do the calculation but it's not working (line 10).&lt;/LI&gt;&lt;LI&gt;I also tried to do the calculation in my GroupBy (line 20) and it's not recognizing the var I created in the filters on line 6-7.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I also tried to create a dictionary, and use that but I couldn't get that to work either &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My end goal is to multiply the 'Tally' field for each 'Stand_No' by 50 or 100 (as determined by 'Plot_Sizes' of 0.02 and 0.01).&amp;nbsp; I then need to find the average for those new (Tally*50 and Tally*100) numbers for each 'Stand_No'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  var p = 'https://maps.arcgis.com'
  var itemId = 'a8af124e92af44579e3fd07bb59ebb4c'
  var fs = FeatureSetByPortalItem(Portal(p), itemId, 0, ['Stand_No', 'Tally', 'Plot_Configuration', 'Plot_Name', 'Plot_Status', 'Plot_Size', 'DBH', 'Height', 'Cruiser_Name', 'Exit_Plot_Time'], false)
 
  //Separate Plot Size into 2 groups for planting
  var plot50 = Filter(fs, 'Plot_Size = (0.02)');
  var plot100 = Filter(fs, 'Plot_Size = (0.01)');

  var TPS = 0

  //Multiply the plot size in plot50 by 2,500, multiply the plot size in plot100 by 10,000)
  var plot_exp = [{name: 'TPS', expression: '(Tally * 2500)', statistic: 'MAX'}]
  //return plot_exp
  
  var summary = GroupBy(fs,['Stand_No','Plot_Configuration','Plot_Size', 'Cruiser_Name'], 
    [{name: 'TallySum', expression: 'Tally', statistic: 'SUM'},
      {name: 'TCount', expression: '1', statistic: 'COUNT'},
      {name: 'AvgDBH', expression: 'DBH', statistic: 'AVG'},
      {name: 'AvgHeight', expression: 'Height', statistic: 'AVG'},
      {name: '50TPS', expression: '(@plot50 * 2500)', statistic: 'AVG'}])
        Console(summary)

  return summary
 
  //Goal is to obtain the Trees per Acre per Stand for each Stand
&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>Thu, 09 Mar 2023 07:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1265881#M50775</guid>
      <dc:creator>M_M</dc:creator>
      <dc:date>2023-03-09T07:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Arcade Data Expression in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1265964#M50781</link>
      <description>&lt;P&gt;The SQL expressions used in GroupBy will recognize numeric and text data, but not objects like FeatureSets. If you need to apply a different calculation based on a field's value, you can do that in the SQL expression using &lt;STRONG&gt;CASE&lt;/STRONG&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var plot_exp = `CASE
    WHEN Plot_Size = 0.02 THEN Tally * 0.02
    WHEN Plot_Size = 0.01 THEN Tally * 0.01
    ELSE Tally -- or some other default value
END`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Just swap that in as one of the expressions in your GroupBy function, and you should get results like you expect.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 14:17:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1265964#M50781</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-03-09T14:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Arcade Data Expression in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1266065#M50793</link>
      <description>&lt;P&gt;That works perfectly, thank you so much!! I really appreciate the help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 17:07:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/need-help-with-arcade-data-expression-in-dashboard/m-p/1266065#M50793</guid>
      <dc:creator>M_M</dc:creator>
      <dc:date>2023-03-09T17:07:33Z</dc:date>
    </item>
  </channel>
</rss>

