Hi Community,
This is probably a simple question but someone like myself who's knew into arcade coding and coding in general, I still struggle haha. I have done some research and thought this would work but I am still getting an error. Basically the code below pulls results from the layer 'National Reserve System' that overlays another layer called IBRA, and produces a percentage value of how much is overlaid/impacted. The code works but now I want to get the results to be listed in alphabetical order. I put in a code that I thought might do it (var sortlist = OrderBy(resultlist, 'Name ASC') but I get this result - Test execution error: Execution error - Invalid parameter. Verify test data.
I know it's probably an easy fix but any ideas of how to fix this would be greatly appreciated 🙂
var impact_areas = Intersects($feature, FeatureSetByName($map, 'National Reserve System', ['*'], true));
var total_impacted_area = 0;
var total_area = $feature.HECTARES; // Assuming 'HECTARES' is the field representing area in IBRA 7 Regions
var resultList = "";
// Coding line that I thought would list the results in alphabetical order
var sortlist = OrderBy(resultlist, 'Name ASC');
// Check if impact_areas is empty
if (Count(impact_areas) == 0) {
resultList = "0%";
} else {
for (var ia in impact_areas) {
var capadName = ia['Name'];
var capadArea = AreaGeodetic(Intersection($feature, ia), 'HECTARES');
var capadPerc = Round((capadArea / total_area) * 100, 1);
// Check if percentage is greater than or equal to 0.01%
if (capadPerc >= 0.01) {
// Concatenate each item with a bullet dot and newline
var resultItem = "• " + capadName + ': ' + Text(capadPerc) + ' %' + TextFormatting.NewLine;
resultList += resultItem;
total_impacted_area += capadArea;
}
}
}
// Return the results with bullet points and handle the case of no overlap
if (IsEmpty(resultList)) {
return "0%";
} else {
return TextFormatting.NewLine + resultList;
}
Thanks,
Matt.