Hello! I am relatively new to arcade and dashboards. I am trying to work around that FieldMaps doesn't allow users to choose more than one option for a collection ie a feature collection can only have "flying dumping" not "fly dumping" AND "water discharge".
I have created three separate fields that can be collected per feature to account for this "encroachment-type-1", "encroachment-type-2", and "encroachment-type'3". In addition users can collect this information as a point, line, or polygon (all housed in group feature layer) based on what is most appropriate.
I want to pull a count of each encroachment type across the 3 layers.
Here's an example of my code to get a count for the first encroachment type "mowing (turf grass)". How could this be improved? It is showing that the first Filter() function is invalid and beyond that idk if it will run.
The quotes are incorrect on the SQL Statement within the Filter function. It should like this:
"Encroachment_Type_1 = 'Mowing (turf grass)' OR Encroachment_Type_2 = 'Mowing (turf grass)' OR Encroachment_Type_3 = 'Mowing (turf grass)'"Since the Filters appear to be the same except for the layerID, you can use a loop to simplify things.
var ids = [0, 1, 2];
var MowingCount = 0;
for (var id of ids) {
MowingCount += Count(
Filter(
FeatureSetByPortalItem(
Portal("https://www.arcgis.com"),
"itemID",
id,
["Encroachment_Type_1", "Encroachment_Type_2", "Encroachment_Type_3"],
false
),
"Encroachment_Type_1 = 'Mowing (turf grass)' OR Encroachment_Type_2 = 'Mowing (turf grass)' OR Encroachment_Type_3 = 'Mowing (turf grass)'"
)
);
}
return MowingCount;