If I am understanding this correctly, you want the expression to return all colours whose value is equal to the maximum value. This could be a single colour, or multiple, if there are ties.
Finding the max value is easy enough:
var colour_values = [
$feature.blue,
$feature.green,
$feature.yellow,
$feature.orange,
$feature.red
]
var max_val = Max(colour_values)
But then once you get the value, what do you do with it?
A simple approach is to just get the index positions of the maximum values, then decode those back to the names. Matching values can be pushed to an array, and we can use Concatenate to format the array as a nice string.
var top_colours = []
for (var v in colour_values){
if (colour_values[v] == max_val){
var colour_name = Decode(
v,
0, 'Blue',
1, 'Green',
2, 'Yellow',
3, 'Orange',
4, 'Red',
''
)
Push(top_colours, colour_name)
}
}
return Concatenate(top_colours, ', ')
Here's the output from manually entering your example values:
- Josh Carlson
Kendall County GIS