Hello!
I have two point feature layers, one is for Mine Sites and the second is for Mine Features. What I want to do is write an arcade expression to be used in the pop-up which displays the count of Mine Features for each Mine Site. They do not have a relate to connect them but I assumed it would be possible to pull the data through FeatureSetByPortalItem. Both feature layers contain the matching fields such as "OFFICIAL_N".
I have it written two ways but I'm sure I'm missing a step somewhere to make it work in the pop-up. As neither are giving me the result I want.
This option gives me the counts based on the Official Name which is the same between both feature layers. but when I try to use this expression in the pop-up it returns [object Object] instead of the numbered Counts. But when I run it in the Arcade Window it does give me the total counts for each Name.
'ID', 0, ['OFFICIAL_N'], False);
var counts = Groupby(fs,['OFFICIAL_N'],
[{name:'Total', expression: 'OFFICIAL_N',
statistic: 'COUNT'}
]);
return counts
Or this code which has an additional for loop but in the pop-up it says that there are 3 features a every site which is incorrect.
'ID', 0, ['OFFICIAL_N'], False);
var counts = Groupby(fs,['OFFICIAL_N'],
[{name:'Total', expression: 'OFFICIAL_N',
statistic: 'COUNT'}
]);
for (var item in counts){
var totalcount = item['Total']
var result = TextFormatting.NewLine + 'Total Number of Features at Mine Site: ' + totalcount
}
return result
I know I am probably missing something somewhere in the code but can't figure it out so any help would be greatly appreciated as I am new to Arcade!