Hi
I want to display a table in ArcGIS Dashboard that contains data from two different featureLayers (datasets).
- I cannot use the Merge-functionality in ArcGIS Pro because the first featureLayers using geopoint, while the second featureLayer using polylines.
- Therefore I am trying to make an Arcade DataExpression to create a dictionary consising of data from the two different featureLayers.
- The two featureLayers both include the same fields ['objectid','CreationDate','Creator','formStatus','nettniva','id','komponenttype','driftsmerking','message','globalid','classid','spenning']
- I am NOT using any filtering inside the Arcade-expression other than only selecting the fields I want to display in the table.
- I then want to use the ArcadeExpression in both a table and indicator widget (if possible) in the ArcGIS Dashbord.
- When I use "return fs1;" I get data from my first featureLayer. This works but its not what I want., see the attached image "Image1 fs1.png".
- When I use "return fs2;" I get data from my second featureLayer. This works but its not what I want., see the attached image "Image2 fs2.png".
- But when I use "return FeatureSet(Text(dict));" I only get a empty dictionary, see the attached image "Image3 empty dictionary.png".
Is there any easier solution to this problem?
If not, can you see any errors in my Arcade Expression?
Since Im new to Arcade I may need a detailed description, but appreciate any tips 🙂
//Totalt antall rapporterte avvik Tabell
//ArcGIS Portal
var p = Portal('https://kraftnett.maps.arcgis.com');
//var all_fields = ['objectid','CreationDate','Creator','formStatus','nettniva','id','komponenttype','driftsmerking','message','globalid','classid','spenning']
//Feature: PointObject
var itemID_points = 'fbf01e5a639a4a3ea335e089652c109a';
var layerID_points = 0;
var fields_points = ['objectid','globalid','creationdate','creator','formStatus','nettniva','komponenttype'];
//Pull PointObject data
var fs1 = FeatureSetByPortalItem(p, itemID_points, layerID_points, fields_points, false);
//Create empty dictionary
var dict = {
'fields': [
{'name': 'ObjectId', 'type': 'esriFieldTypeInteger'},
{'name': 'GlobalId', 'type': 'esriFieldTypeString'},
{'name': 'CreationDate', 'type': 'esriFieldTypeDate'},
{'name': 'Creator', 'type': 'esriFieldTypeString'},
{'name': 'FormStatus', 'type': 'esriFieldTypeString'},
{'name': 'Nettniva', 'type': 'esriFieldTypeString'},
{'name': 'KomponentType', 'type': 'esriFieldTypeString'}
],
'geometryType': '',
'features': []
};
var index = 0;
//Loop through and add PointFeature data to dictionary
for (var feature in fs1) {
dict.features[index++] = {
'attributes': {
'objectid': feature['objectid'],
'globalid': feature['globalid'],
'creationdate': feature['creationdate'],
'creator': feature['creator'],
'formStatus': feature['formStatus'],
'nettniva': feature['nettniva'],
'komponenttype': feature['komponenttype']
}
}
};
//Feature: LineObjects
var itemID_lines = '24481a7dc6d342db9c5b43cc8af9b8c1';
var layerID_lines = 0;
var fields_lines = ['objectid','globalid','creationdate','creator','formStatus','nettniva','komponenttype'];
//Pull LineObject data
var fs2 = FeatureSetByPortalItem(p, itemID_lines, layerID_lines, fields_lines, false);
//Loop through and add PointFeature data to dictionary
for (var feature in fs2) {
dict.features[index++] = {
'attributes': {
'objectid': feature['objectid'],
'globalid': feature['globalid'],
'creationdate': feature['creationdate'],
'creator': feature['creator'],
'formStatus': feature['formStatus'],
'nettniva': feature['nettniva'],
'komponenttype': feature['komponenttype']
}
}
};
//Return result
//return fs1;
return FeatureSet(Text(dict));
//return dict;
//return [fs1, fs2]
Regards Lars