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.