I want to create an indicator to count items from multiple layers. Is there any arcade expression example or any reference? Any idea will be appreciated.
@SayedWali- Just to recap and post the solution here, rather than in a private message:
var portal = Portal('https://npaid.maps.arcgis.com'); var FAR = FeatureSetByPortalItem( portal, '56db417ebbc541bcbb6ccf9c49524cc9', 0, ['*'], false ) var PDIA = FeatureSetByPortalItem( portal, '56db417ebbc541bcbb6ccf9c49524cc9', 0, ['*'], false ) var total_count = Count(FAR) + Count(PDIA) var outDict = { fields: [{ name: 'total', type: 'esriFieldTypeInteger'}], geometryType: '', features: [{attributes: {total: total_count}}], }; // Return dictionary cast as a feature set return FeatureSet(Text(outDict));
@jcarlson , one more question, from the two layers, I want to get a shared field as a long list. For example, I want to have a list of all object IDs from both layers. any idea to edit the expression?
Hi @jcarlson , Thank you very much!
There are a number of examples on ESRI's Arcade expressions GitHub repo. Here's one that counts items from multiple layers for a chart:
https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CombineMultipleLayers(SerialChart).md
If you haven't used a Data Expression before, they can look a lot more complicated than they really are. The linked example should apply just as easily to an Indicator widget.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.