<?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 Dashborad - Add new values into hosted table in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1079621#M4807</link>
    <description>&lt;P&gt;You can't really have a true "table" in a Dashboard. You can have a table-like &lt;STRONG&gt;List&lt;/STRONG&gt; element, but you'd need to calculate the new fields using a data expression, which I think is what you're attempting here, yes?&lt;/P&gt;&lt;P&gt;Can you share the code you've used so far and any errors you've gotten? That can be helpful.&lt;/P&gt;&lt;P&gt;Assuming you want a data expression, maybe something like this would work. It's hard to say sight unseen, and you'll probably need to tweak this to match your data, but it's a starting point at least.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var outDict = { 
    'fields': [{'name':'Year', 'type':'esriFieldTypeInteger'},
               {'name':'Type', 'type':'esriFieldTypeString'},
               {'name':'ValueA', 'type':'esriFieldTypeInteger'},
               {'name':'ValueB', 'type':'esriFieldTypeInteger'},
               {'name':'YearPrev', 'type':'esriFieldTypeInteger'},], 
    'geometryType': '', 
    'features': []
}

var f_index = 0

var fs = FeatureSetBy // You can fill this in with however you're accessing your layer

for(var f in fs){
    var t = f.Type
    var y = f.Year - 1
    var prev = Filter(fs, 'Type = @t and Year = @y')
    var prev_a = ''
    var prev_b = ''

    // make sure your filter returned something, then replace prev values
    if(Count(prev) &amp;gt; 0){
        prev_a = First(prev)['ValueA']
        prev_b = First(prev)['ValueB']
    }

    outDict.features[f_index] = {
        'attributes': {
            'Year': f['Year'],
            'Type': t,
            'ValueA': f['ValueA'],
            'ValueB': f['ValueB'],
            'PrevYear': y,
            'PrevValueA': prev_a,
            'PrevValueB': prev_b
         }
     }
     
     f_index++
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jul 2021 12:10:44 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-07-16T12:10:44Z</dc:date>
    <item>
      <title>Arcade Dashborad - Add new values into hosted table</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1079568#M4806</link>
      <description>&lt;P&gt;For the purposes of a dashboard tool, I need to have a set of informations in a single table. To do this I try with Arcade queries to get my result.&lt;/P&gt;&lt;P&gt;Here is my table as a starter. (attachment 1.PNG)&lt;/P&gt;&lt;P&gt;One set of values per year and per type.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="attachment1.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18625iED15AED70831A0D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="attachment1.PNG" alt="attachment1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;and this is what I'm looking for as a result (attachement2.PNG)&lt;/P&gt;&lt;P&gt;New fields with values already present in the table&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="attachment2.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18626iF30063521D1AAFF2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="attachment2.PNG" alt="attachment2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;I have tried a lot of things using dictionaries but without any convincing results.&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;&lt;P&gt;I have tried a lot of things using dictionaries but without any convincing results.&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 04:51:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1079568#M4806</guid>
      <dc:creator>explocarto</dc:creator>
      <dc:date>2021-07-16T04:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Dashborad - Add new values into hosted table</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1079621#M4807</link>
      <description>&lt;P&gt;You can't really have a true "table" in a Dashboard. You can have a table-like &lt;STRONG&gt;List&lt;/STRONG&gt; element, but you'd need to calculate the new fields using a data expression, which I think is what you're attempting here, yes?&lt;/P&gt;&lt;P&gt;Can you share the code you've used so far and any errors you've gotten? That can be helpful.&lt;/P&gt;&lt;P&gt;Assuming you want a data expression, maybe something like this would work. It's hard to say sight unseen, and you'll probably need to tweak this to match your data, but it's a starting point at least.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var outDict = { 
    'fields': [{'name':'Year', 'type':'esriFieldTypeInteger'},
               {'name':'Type', 'type':'esriFieldTypeString'},
               {'name':'ValueA', 'type':'esriFieldTypeInteger'},
               {'name':'ValueB', 'type':'esriFieldTypeInteger'},
               {'name':'YearPrev', 'type':'esriFieldTypeInteger'},], 
    'geometryType': '', 
    'features': []
}

var f_index = 0

var fs = FeatureSetBy // You can fill this in with however you're accessing your layer

for(var f in fs){
    var t = f.Type
    var y = f.Year - 1
    var prev = Filter(fs, 'Type = @t and Year = @y')
    var prev_a = ''
    var prev_b = ''

    // make sure your filter returned something, then replace prev values
    if(Count(prev) &amp;gt; 0){
        prev_a = First(prev)['ValueA']
        prev_b = First(prev)['ValueB']
    }

    outDict.features[f_index] = {
        'attributes': {
            'Year': f['Year'],
            'Type': t,
            'ValueA': f['ValueA'],
            'ValueB': f['ValueB'],
            'PrevYear': y,
            'PrevValueA': prev_a,
            'PrevValueB': prev_b
         }
     }
     
     f_index++
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 12:10:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1079621#M4807</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-07-16T12:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Dashborad - Add new values into hosted table</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1081611#M4825</link>
      <description>&lt;P&gt;Hello Josh,&lt;/P&gt;&lt;P&gt;This is exactly what I need. I learned a lot from your code.&lt;/P&gt;&lt;P&gt;Thanks a lot !&lt;/P&gt;&lt;P&gt;Have a nice day&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 02:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashborad-add-new-values-into-hosted-table/m-p/1081611#M4825</guid>
      <dc:creator>explocarto</dc:creator>
      <dc:date>2021-07-22T02:40:07Z</dc:date>
    </item>
  </channel>
</rss>

