Select to view content in your preferred language

Arcade Data Expression- Dictionary from multiple tables

4386
20
Jump to solution
12-23-2021 08:04 AM
TSmith
by
Regular Contributor

Hello,

I am interested in feeding a dashboard with values from multiple tables. I have the following code below: 

 

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
};

 

 

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 

Execution Error:Runtime Error: Cannot call member property on object of this type.

Any help is appreciated! I got something similar working, however all of the values come from the same table. 

0 Kudos
20 Replies
PeterBrad3
Emerging Contributor

I have a similar expression that joins together an asset and its most recent inspection record. The feature set populates with all the data as expected but I would like the feature set to display the domain description instead of the domain code. For example, currently in the output feature set the "Site Type" field for a record is "ts" where I would like it to have its domain description "Transfer Station". Any advice is appreciated.

0 Kudos