Select to view content in your preferred language

Arcade Merge Dictionaries Issue

34
0
4 hours ago
ALICEANSTEE
New Contributor

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.

ALICEANSTEE_0-1720428105738.png

ALICEANSTEE_1-1720428114603.png

Any Ideas where I've gone wrong? The Feature(Text(OutputDict)); just returns a blank table.

 

Thanks 🙂

 

 

 

0 Kudos
0 Replies