Can you join Related Tables for an Indicator or Pie Chart Element?

02-20-2024 08:54 AM
New Contributor III

Hi all,

I am brand new to Arcade Expressions and I am wondering if I can do what the title states. I found this resource

"Join attributes from a layer to a table"

I've tried emulating it with no avail (see reply below).

Currently I have two lists but its a bit awkward as the lists can't filter all the category selectors. Which in turn can't filter my Pie Chart (which is a sum of the "replacement_cost" field of the grouped field "Condition_Rating".

Any guidance on this matter?

0 Kudos
1 Reply
New Contributor III

So far this is what I've done but when I enter it as an arcade expression into a pie chart or a serial chart, the expression fails and i get no error or return in the Message box. It also says that my expression is invalid. Not sure what to exactly do.


var portals = Portal("Portal URL");
var pointfs = FeatureSetByPortalItem(
    "Item ID",

var tablefs = FeatureSetByPortalItem(
    5, //this is a sublayer item id of 5 

// Create empty features array and feat object
var features = [];
var feat;

// Populate Feature Array
for (var t in tablefs) {
    var tableID = t["Asset_ID"]
    for (var p in Filter(pointfs, "Asset_ID = "+tableID)){
        feat = {
            attributes: {
                Asset_ID: tableID,
                // Fields from pointfs
                Building_Name: p["Building_Name"],
                Facilities_Building_ID: p["Facilities_Building_ID"],
                GIS_Building_ID: p["GIS_Building_ID"],
                Uniformat_Code: p["Uniformat_Code"],
                Uniformat_Name: p["Uniformat_Name"],
                Assessment_Description: p["Assessment_Description"],
                Component_Manufacturer: p["Component_Manufacturer"],
                Unit_Cost: p["Unit_Cost"],
                Assessment_Qty: p["Assessment_Qty"],
                Expected_Useful_Life: p["Expected_Useful_Life"],
                Replacement_Cost: p["Replacement_Cost"],
                // Fields from tablefs
                Condition_Rating: t["Condition_Rating"],
                Condition_Narrative: t["Condition_Narrative"],
                Recommendation_Year: t["Recommendation_Year"]
    Push(features, feat)

var joinedDict = {
    fields: [
        // Fields from pointfs
        { name: "Asset_ID", type: "esriFieldTypeInteger" },
        { name: "Building_Name", type: "esriFieldTypeString" },
        { name: "Facilities_Building_ID", type: "esriFieldTypeString" },
        { name: "GIS_Building_ID", type: "esriFieldTypeString" },
        { name: "Uniformat_Code", type: "esriFieldTypeString" },
        { name: "Uniformat_Name", type: "esriFieldTypeString" },
        { name: "Assessment_Description", type: "esriFieldTypeString" },
        { name: "Component_Manufacturer", type: "esriFieldTypeString" },
        { name: "Unit_Cost", type: "esriFieldTypeDouble" },
        { name: "Assessment_Qty", type: "esriFieldTypeDouble" },
        { name: "Expected_Useful_Life", type: "esriFieldTypeDouble" },
        { name: "Replacement_Cost", type: "esriFieldTypeDouble" },
        // Fields from tablefs
        { name: "Condition_Rating", type: "esriFieldTypeString" },
        { name: "Condition_Narrative", type: "esriFieldTypeString" },
        { name: "Recommendation_Year", type: "esriFieldTypeDouble" }
    geometryType: 'esriGeometryPoint', 
    features: features

// Return dictionary cast as a feature set 
return FeatureSet(Text(joinedDict));


0 Kudos