Hi. I have one point feature layer (full of address points) and one table that has information that I want to join to the point features layer via common attribute - postcodesector (this is labelled as ORNAGISATION in the point layer).
I have successfully joined the required attributes using the expression below:
var portal_Link = Portal('xyz');
var pointfs = FeatureSetByPortalItem(portal_Link,'17d25668c1ee4904ac2920558175f291',0,["*"], true);
var tablefs = FeatureSetByPortalItem(portal_Link,'76a135fad8db4da7bc2932ec7c58dd5b',0,["*"], false);
var fields = ["user_postsector", "user_postcodesectoraverage", "user_postsectorcountvalued"];
var DistinctTablefs = Distinct(tablefs, fields)
var OutputDict = {
fields: [
{name: "organisation", type: "esriFieldTypeString"},
{name: "PostcodeSectorAv", type: "esriFieldTypeInteger"},
{name: "PostcodeSectorCount", type: "esriFieldTypeInteger"},
{name: "GSS_CODE", type: "esriFieldTypeString"},
],
geometryType: "esriGeometryPoint",
features: []};
for (var p in pointfs){
var tableID = p["organisation"]
var House_Est = Filter(DistinctTablefs, "user_postsector=@tableID")
for (var t in House_Est){
var PostSectAv = t.user_postcodesectoraverage
var PostSectCount = t.user_postsectorcountvalued
var PostSect = t.user_postsector
var GSS = p.GSS_CODE
Push(OutputDict.features,{
'attributes':{
'organisation': PostSect,
'PostcodeSectorAv': PostSectAv,
'PostcodeSectorCount': PostSectCount,
'GSS_CODE': GSS}
})
}}
Console(OutputDict)
return FeatureSet(Text(OutputDict));
But this outputs all the values as individual dictionarties and I would prefer to have this as one new table / dynamic feature set to use in a pie chart.
Any Ideas where I've gone wrong? The Feature(Text(OutputDict)); just returns a blank table.
Thanks 🙂
You're assigning the dictionary a geometry type, but not using that at all. Try using this
var OutputDict = {
fields: [
{ name: "organisation", type: "esriFieldTypeString" },
{ name: "PostcodeSectorAv", type: "esriFieldTypeInteger" },
{ name: "PostcodeSectorCount", type: "esriFieldTypeInteger" },
{ name: "GSS_CODE", type: "esriFieldTypeString" }
],
geometryType: "",
features: []
};
Thanks - this still produces multiple dictionaries whereas I want these results in a feature set to run my pie chart off on dashboards. any ideas on this? Thanks