Hi, I have created Featureset based on the attributes joined from two layers. Now, my intent is to configure popup based on the fields from the featureset/dictionary created in the arcade. I am not sure how to return the fields for the popup window?
my code so far is as here:
var portal = Portal("portallink")
var Grid = FeatureSetByPortalItem(
portal,
"itemid",
1,
["*"],
false
);
var Loading = FeatureSetByPortalItem(
portal,
"itemid",
3,
["*"],
false
);
// Create empty features array and feat object
var features = [];
var feat;
for (var t in Loading) {
var tableID = t["GRID_ID"]
for (var p in Filter(Grid, "stationid= '"+tableID+"'")){
feat = {
attributes: {
Name: t["GRID_STATION"],
Grid_ID:tableID,
Grid_Amp:t["GRID_LOADINGS_AMP"],
Grid_Per:t["GRID_PER"]
}
}
Push(features, feat)
}
}
var joinedDict = {
fields: [
{ name: "Name", type: "esriFieldTypeString" },
{ name: "Grid_ID", type: "esriFieldTypeString" },
{ name: "Grid_Amp", type: "esriFieldTypeString" },
{ name: "Grid_Per", type: "esriFieldTypeString" },
],
'geometryType': '',
'features':features
};
// Return dictionary cast as a feature set
return FeatureSet(Text(joinedDict));
I am also struggling with the same goal! There is no documentation to simply return a field from a feature set. I was using a filterStatement but this filters the entire feature set, I can't figure out how to pull a specific field to display in my pop-up.
I finally found a spec of info! Hidden towards the bottom is a for-loop arcade script that I was able to use.