Hi,
@XanderBakker
I've written the Data Expression below and it works but it is very slow. Too slow to be used in the dashboard I've created. I'm creating this because no matter how many times I inform people that my maps and dashboards are interactive they always seem to forget.
Below are two images. The one on the left is two indicator widgets and a list widget, and if you select an item in the list widget it will filter the two indicators along with a map. I've been asked if I could just add the Registrations and Participants next to each District. The image on the right is a list widget accomplishing what was asked but it can take anywhere from 30 secs to over a minute to load.
I'm still new to writing code and I've read that depending on how you write Arcade it can impact its performance.
 |  |
var boundaries = FeatureSetByPortalItem(
Portal('https://arcgis.com/'),
'a1795cc14f9744d68787f649a7865715',
1);
var nno = FeatureSetByPortalItem(
Portal('https://arcgis.com/'),
'6d13be8f482e434ea129f751c00385b0',
0);
var outputDict = {'fields': [
{ 'name': 'MEMBER', 'type': 'esriFieldTypeString'},
{ 'name': 'Type', 'type': 'esriFieldTypeString'},
{ 'name': 'DISTRICT', 'type': 'esriFieldTypeString'},
{ 'name': 'District_Sort', 'type': 'esriFieldTypeString'},
{ 'name': 'NNO_Count', 'type': 'esriFieldTypeInteger'},
{ 'name': 'NNO_Attendance', 'type': 'esriFieldTypeInteger'}],
'geometryType': '', 'features': []};
var index = 0;
for (var boundary in boundaries) {
var nnoint = Intersects(boundary,nno)
var nnocount = Count(nnoint)
var nnosum = Sum(nnoint, 'Expected_Attendance')
outputDict.features[index++] = {
'attributes': {'MEMBER': boundary['MEMBER'],
'Type': boundary['Type'],
'DISTRICT': boundary['DISTRICT'],
'District_Sort': boundary['District_Sort'],
'NNO_Count': nnocount,
'NNO_Attendance': nnosum}
}}
return FeatureSet(Text(outputDict));