<?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 Data Expression- Dictionary from multiple tables in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1291111#M7857</link>
    <description>&lt;P&gt;Thanks for sharing solution for this issue, we got it too. Converting the date field to number fix it!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 15:50:24 GMT</pubDate>
    <dc:creator>abul123</dc:creator>
    <dc:date>2023-05-19T15:50:24Z</dc:date>
    <item>
      <title>Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128645#M5545</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am interested in feeding a dashboard with values from multiple tables. I have the following code below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('yourportalurlhere');
var valvefs = FeatureSetByPortalItem(portal,'id',index,["*"],false);
for (var v in valvefs){
   var relatedrecords = OrderBy(FeatureSetByRelationshipName(v, 'System_Valve_Inspection', ["*"],false),'insdate DES');
   var recentrecord = First(relatedrecords)
   for (var r in recentrecord){
       var feat = {
           attributes: {
               assetid: r["valveid"],
               insdate: r["insdate"],
               diameter: v["diameter"],
               turns: r["turns"],
               fintorque: r["fintorque"],
           }
       }
   } Push(features,feat);
};
var joinedDict = {
  fields: [
    { name: "assetid", type: "esriFieldTypeString" },
    { name: "insdate", type: "esriFieldTypeDate" },	
    { name: "fintorque", type: "esriFieldTypeDouble" },
    { name: "turns", type: "esriFieldTypeDouble" },
    { name: "diameter", type: "esriFieldTypeDouble" },
  ],
geometryType: '',
features: features
};
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wanting to grab two values from the parent table (diameter and assetID) and other values from the most recent inspection record. I'm not sure why the code isn't working, but the error I keep getting is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN&gt;Runtime Error: Cannot call member property on object of this type.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help is appreciated! I got something similar working, however all of the values come from the same table.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:04:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128645#M5545</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T16:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128659#M5546</link>
      <description>&lt;P&gt;Your expression looks good, for the most part. However, since you use &lt;STRONG&gt;First&lt;/STRONG&gt; to return the first feature from your &lt;STRONG&gt;relatedrecords&lt;/STRONG&gt;, there's no reason to include a for loop over &lt;STRONG&gt;recentrecord&lt;/STRONG&gt;, as it is already a singular feature.&lt;/P&gt;&lt;P&gt;Iterating over a feature goes through its fields. So when you say "for var r in recentrecord", you're telling the expression to loop through each field in the feature, and that's why you're getting the error, since the individual attribute key/value pairs don't have the attributes you're trying to pull out. To demonstrate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = $layer

var f_1 = First(fs)

for (var f in f_1){
    console(`${f} : ${f_1[f]}`)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Returns this in the messages:&lt;/P&gt;&lt;PRE&gt;BASEELEV : 141.36
BLDGHEIGHT : 10.74
BUILDINGID : 0712218018
EAVEHEIGHT : 10.74
FEATURECODE : 561
FLOORCOUNT : 0
LASTEDITOR : ESRI
LASTUPDATE : 2010-01-18T18:00:00-06:00
OBJECTID : 1
ROOFDIR : 0
ROOFFORM : Flat
SHAPE__Area : 55.71875
SHAPE__Length : 30.689584083596625&lt;/PRE&gt;&lt;P&gt;Just drop the "for r in recentrecord" loop and define the &lt;STRONG&gt;feat &lt;/STRONG&gt;object in the larger "for v in valvefs" loop.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:28:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128659#M5546</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-23T16:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128669#M5547</link>
      <description>&lt;P&gt;That solved the error, but now my output is empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the dictionary needs an identifier to map the fields, and with the for loop gone, how do I map the fields only present in the related record?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for (var v in valvefs){
   var relatedrecords = OrderBy(FeatureSetByRelationshipName(v, 'System_Valve_Inspection', ["*"],false),'insdate DES');
   var recentrecord = First(relatedrecords)
       var feat = {
           attributes: {
               assetid: ["valveid"],
               insdate: ["insdate"],
               diameter: v["diameter"],
               turns: ["turns"],
               fintorque: ["fintorque"],
           }
       }
       Push(features,feat);
   };
var joinedDict = {
  fields: [
    { name: "assetid", type: "esriFieldTypeString" },
    { name: "insdate", type: "esriFieldTypeDate" },	
    { name: "fintorque", type: "esriFieldTypeDouble" },
    { name: "turns", type: "esriFieldTypeDouble" },
    { name: "diameter", type: "esriFieldTypeDouble" },
  ],
geometryType: '',
features: features
};
return FeatureSet(Text(joinedDict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128669#M5547</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T16:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128670#M5548</link>
      <description>&lt;P&gt;Ah, okay. So, we still need to tell the expression where it's getting those attributes. &lt;STRONG&gt;recentrecord&lt;/STRONG&gt; is the feature, so try something like this in defining your &lt;STRONG&gt;feat&lt;/STRONG&gt; object. &lt;STRIKE&gt;I don't actually know which fields are coming from which feature, so I made a guess.&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var feat =
    attributes: {
        assetid: recentrecord["valveid"],
        insdate: recentrecord["insdate"],
        diameter: v["diameter"],
        turns: recentrecord["turns"],
        fintorque: recentrecord["fintorque"],
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I just re-read your original expression. Just replace those "r"s with "recentrecord" and it should work.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:50:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128670#M5548</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-23T16:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128673#M5549</link>
      <description>&lt;P&gt;ah, simpler than I thought. It doesn't like null values though, and I'm not sure which field specifically is null. (Cannot call member method on null) maybe some additional logic to change nulls to "unknown"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128673#M5549</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T16:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128684#M5551</link>
      <description>&lt;P&gt;Null fields are fine to work with, it's the fact that you're probably trying to pull attributes &lt;STRONG&gt;from&lt;/STRONG&gt; a null. You end up with a null when your related records featureset is empty.&lt;/P&gt;&lt;P&gt;Throw it inside of a big &lt;STRONG&gt;if &lt;/STRONG&gt;that checks the &lt;STRONG&gt;Count&lt;/STRONG&gt; of the &lt;STRONG&gt;relatedrecords&lt;/STRONG&gt; featureset, and only proceeds to add a feature if records exist.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (Count(relatedrecords)&amp;gt;0){
    // do your recentrecord and feat stuff
}&lt;/LI-CODE&gt;&lt;P&gt;If you want to add something to the output for features with no related records, you can add an &lt;STRONG&gt;else&lt;/STRONG&gt; statement and manually define the &lt;STRONG&gt;feat&lt;/STRONG&gt; object with strings like 'No inspections on record', rather than pull related attributes.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1640279338764.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30314i05428D6E4A8F467A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1640279338764.png" alt="jcarlson_0-1640279338764.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1640279348312.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30315iF894D2C58AA41377/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1640279348312.png" alt="jcarlson_1-1640279348312.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 17:14:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128684#M5551</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-23T17:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128688#M5552</link>
      <description>&lt;P&gt;Making more progress, but when I test the code it now outputs empty rows.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for (var v in valvefs){
   var relatedrecords = OrderBy(FeatureSetByRelationshipName(v, 'System_Valve_Inspection', ["*"],false),'insdate DES');
   if (Count(relatedrecords)&amp;gt;0){
        var recentrecord = First(relatedrecords)
        var feat = {
           attributes: {
               valveid: recentrecord["valveid"],
               insdate: recentrecord["insdate"],
               diameter: v["diameter"],
               turns: recentrecord["turns"],
               fintorque: recentrecord["fintorque"],
           }
       }
       Push(features,feat);
   };
};   
var joinedDict = {
  fields: [
    { name: "assetid", type: "esriFieldTypeString" },
    { name: "insdate", type: "esriFieldTypeDate" },	
    { name: "fintorque", type: "esriFieldTypeDouble" },
    { name: "turns", type: "esriFieldTypeDouble" },
    { name: "diameter", type: "esriFieldTypeDouble" },
  ],
geometryType: '',
features: features
};
return FeatureSet(Text(joinedDict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 17:33:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128688#M5552</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T17:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128697#M5554</link>
      <description>&lt;P&gt;Can you share a screenshot of the output? Unless your data has empty rows to begin with, that shouldn't be happening.&lt;/P&gt;&lt;P&gt;Also, your &lt;STRONG&gt;joinedDict&lt;/STRONG&gt; object defines a field "assetid", but the &lt;STRONG&gt;feat&lt;/STRONG&gt; object has a "valveid" attribute now, so it's not going to pick that attribute up.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 17:49:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128697#M5554</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-23T17:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128699#M5555</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TSmith_0-1640281960509.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30322i34F280858FBFF959/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TSmith_0-1640281960509.png" alt="TSmith_0-1640281960509.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It takes a long time to run so it's doing something. There are only 900 valves, but over 10,000 inspection records. I did change the field names so they all match. I wonder if it has something to do with the order of my loops?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 17:53:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128699#M5555</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T17:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128708#M5556</link>
      <description>&lt;P&gt;You could try manually specifying the output fields in the &lt;STRONG&gt;relatedrecords&lt;/STRONG&gt; featureset. Setting ['*'] returns all the attributes, which adds to the processing time, especially if there are many fields. Try&lt;/P&gt;&lt;PRE&gt;["insdate", "turns", "fintorque"]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Couldn't "valveid" be pulled from the parent feature, too?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 18:13:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128708#M5556</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-23T18:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128719#M5559</link>
      <description>&lt;P&gt;I appreciate all the help here, I am still getting a result with an empty table.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var features = [];
var feat;
for (var v in valvefs){
   var relatedrecords = OrderBy(FeatureSetByRelationshipName(v, 'System_Valve_Inspection', ["insdate", "turns", "fintorque"],false),'insdate DES');
   var recentrecord = First(relatedrecords);
   if (Count(relatedrecords)&amp;gt;0){
         
         var feat = {
           attributes: {
               'valveid': v["assetid"],
               'insdate': recentrecord["insdate"],
               'diameter': v["diameter"],
               'turns': recentrecord["turns"],
               'fintorque': recentrecord["fintorque"],
           }
       }
       Push(features,feat);
   };
};   
var joinedDict = {
  fields: [
    { name: "valveid", type: "esriFieldTypeString" },
    { name: "insdate", type: "esriFieldTypeDate" },	
    { name: "fintorque", type: "esriFieldTypeDouble" },
    { name: "turns", type: "esriFieldTypeDouble" },
    { name: "diameter", type: "esriFieldTypeDouble" },
  ],
geometryType: '',
features: features
};
return FeatureSet(Text(joinedDict))&lt;/LI-CODE&gt;&lt;P&gt;would there be a better way to accomplish this? I'm really just interested in grabbing turns, torque, and diameter from the most recent inspection.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 18:40:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128719#M5559</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T18:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128721#M5560</link>
      <description>&lt;P&gt;I mean, if you're working in a dashboard, could you just have a list of valves that filters a details widget for the most recent related record upon selection? Or do you want the inspections part of the valves so the list can be sorted based on inspection data?&lt;/P&gt;&lt;P&gt;I still can't quite understand how you're getting an empty result. Any chance you could export an anonymized / obfuscated subset of the data so that I can test it against live data? I'm assuming the layer isn't public.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 18:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128721#M5560</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-23T18:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128722#M5561</link>
      <description>&lt;P&gt;there might be a better way to do it, but my goal is to filter inspection data to show on a dashboard which valves exceed thresholds (i.e. # of turns greater than a specified amount, or torque greater than a specified amount) the dashboard filtering capabilities are perfect for this, but I need the data in a format the dashboard can use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, working with related tables is proving to be quite frustrating. Would like to just highlight valves due for inspection (this part I have working) but then also flag ones based on past inspections (most recent) which I can't seem to load a dictionary for so far.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 19:00:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128722#M5561</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-23T19:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128741#M5563</link>
      <description>&lt;P&gt;Are you getting a data access error or unable to execute arcade script?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 19:59:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128741#M5563</guid>
      <dc:creator>ahassa22</dc:creator>
      <dc:date>2021-12-23T19:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128987#M5566</link>
      <description>&lt;P&gt;No, no syntax errors or anything like that. It executes and returns an empty featureset with the field names (really odd)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there perhaps a simpler way to accomplish this? I'm realizing Arcade can do a lot, but I'm new to using it in this capacity.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 18:01:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1128987#M5566</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-27T18:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1129406#M5582</link>
      <description>&lt;LI-CODE lang="javascript"&gt;var features = [];
var feat;
for (var v in valvefs){
              var relatedrecords = OrderBy(FeatureSetByRelationshipName(v, 'System_Valve_Inspection', ["insdate", "turns", "fintorque"],false),'insdate DESC');
            
			
			
			  if (Count(relatedrecords)&amp;gt;0){
              var recentrecord = First(relatedrecords);      
              var feat = {
              attributes: {
              'assetid': v["assetid"],
              'insdate': number(recentrecord["insdate"]),
              'diameter': v["diameter"],
              'turns': recentrecord["turns"],
              'fintorque': recentrecord["fintorque"],
           }
       }
       Push(features,feat);
   };
};   
var joinedDict = {
    fields: [
     { name: "assetid", type: "esriFieldTypeString" },
     { name: "insdate", type: "esriFieldTypeDate" },	
     { name: "fintorque", type: "esriFieldTypeDouble" },
     { name: "turns", type: "esriFieldTypeDouble" },
     { name: "diameter", type: "esriFieldTypeDouble" },
    ],
    geometryType: '',
    features: features
};
return FeatureSet(Text(joinedDict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;casting the date as a number solved the issue. My only further question now is this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I wanted to reduce processing time by filtering the related table down to the top 2000 records, or say records only in the past 5 years, would that go before the for loop, or within? I have also considered just creating a hosted view of the data to point this expression to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your input!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 13:17:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1129406#M5582</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2021-12-29T13:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1129503#M5585</link>
      <description>&lt;P&gt;Glad it's working!&lt;/P&gt;&lt;P&gt;Since it's the related records, you'd do a filter like that within the loop, after pulling the related records. Something like&lt;/P&gt;&lt;PRE&gt;var time_endpoint = DateAdd(Now(), -5, 'years')&lt;BR /&gt;var filt_records = Filter(relatedrecords, 'insdate &amp;gt;= @time_endpoint')&lt;/PRE&gt;&lt;P&gt;Then proceed as before, but reference &lt;STRONG&gt;filt_records&lt;/STRONG&gt; in place of the original &lt;STRONG&gt;relatedrecords&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 18:30:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1129503#M5585</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-12-29T18:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1130289#M5601</link>
      <description>&lt;P&gt;I thought that would work, but I get an execution error, probably having something to do with trying to do math on a date field. Maybe creating a new field in memory that's a number? I also know that there's ways to call a sql variable in the filter function, but I'm not sure what the syntax would be.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sql = 'insdate&amp;gt;= DATEADD(year, -5, GETDATE()'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it may also be easier to just filter on number of rows.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 14:17:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1130289#M5601</guid>
      <dc:creator>TSmith</dc:creator>
      <dc:date>2022-01-04T14:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1291111#M7857</link>
      <description>&lt;P&gt;Thanks for sharing solution for this issue, we got it too. Converting the date field to number fix it!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 15:50:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1291111#M7857</guid>
      <dc:creator>abul123</dc:creator>
      <dc:date>2023-05-19T15:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression- Dictionary from multiple tables</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1299937#M7959</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:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-dictionary-from-multiple/m-p/1299937#M7959</guid>
      <dc:creator>DavidNyenhuis1</dc:creator>
      <dc:date>2023-06-15T19:27:39Z</dc:date>
    </item>
  </channel>
</rss>

