I am trying to write a data expression to return fields from 2 different data layers. My data expression looks like this:
var portal = Portal('https://piercecowa.maps.arcgis.com');
var thira = FeatureSetByPortalItem(portal,'aff5dd7c9615404cac256ec6dc627e10', ['*'],false)
var poete = FeatureSetByPortalItem(portal,'aff5dd7c9615404cac256ec6dc627e10', 1, ['*'],false)
// Create empty features array and feat object
var features = [];
var feat;
for (var x in poete){
var ParentGlobalID = x["parentglobalid"]
var poete_area = x['poete_area']
var Name;
var UASI_Jurisdiction;
var Community;
var Core_Capability;
var Target
for (var y in thira ){
if (y["globalid"] == ParentGlobalID){
Name = y['Name']
UASI_Jurisdiction = y['Jurisdiction']
Community = y['Sub_Jurisdiction:']
Core_Capability = y['core_capability']
Target = y['target']
break
}
}
feat = {
attributes: {
Name: Name,
UASI_Jurisdiction: UASI_Jurisdiction,
Community: Community,
Core_Capability: Core_Capability,
Target: Target,
poete_area: poete_area
}
}
Push(features, feat)
}
var joinedDict = {
fields: [
{ name: "ParentGlobalID", type: "esriFieldTypeGUID" },
{ name: "poete_area", type: "esriFieldTypeString" },
{ name: "Name", type: "esriFieldTypeString" },
{ name: "UASI_Jurisdiction", type: "esriFieldTypeString" },
{ name: "Community", type: "esriFieldTypeString" },
{ name: "Core_Capability", type: "esriFieldTypeString" },
{ name: "Target", type: "esriFieldTypeString" },
],
'geometryType': '',
'features':features
};
// Return dictionary cast as a feature set
return FeatureSet(Text(joinedDict));
poete_area data:
thira data:
Solved! Go to Solution.
You're missing the layerid in line 3
You're missing the layerid in line 3
@KenBuja thanks!!