I've had this issue with a couple of different datasets now - if I try and use an Intersects function in a dashboard, it takes over 5 minutes for the dashboard widgets to load, which obviously makes it unusable for the end user.
Below is an example of the Arcade expression I have used for a table widget. The zone featureset has just 2 features, and the s_features featureset has 1500, so a decent amount but not huge. Both are polygon datasets.
Any suggestions of alternative methods I could use to make this quicker?
// Get the datasets
var zone = FeatureSetByPortalItem(Portal('https://arcgis.com'),'<id_hidden>', 0, ['zone'], true)
var s_features = FeatureSetByPortalItem(Portal('https://arcgis.com'),'<id_hidden>', 1, ['HA'], true)
// Create new empty feature set
var new_fs = {
'fields': [{'name': 'Zone', 'type': 'esriFieldTypeString'},
{'name': 'Number', 'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features': []
}
// Tell it what will be contained in each field
for (var z in zone) {
var intersectArea = Intersects(s_features, z);
var countS = count(intersectArea);
var new_zone = z['zone']
Push(new_fs.features, {'attributes': {'Zone': new_zone, 'Number': countS}})
}
// Create new feature set
var zone_count = FeatureSet(Text(new_fs))
return zone_count
Can you run a geoprocess on a regular interval to create this data instead of using a runtime Arcade expression? This might greatly reduce the load time.
Thanks, yes that's the next option if I can't speed up the Arcade. It's a regularly updated dataset so was hoping to avoid a manual process or auto-run script.