Report Studio 10.2
I have a report with a map item where each geographic region's color is based on a three color palette
(i.e. stop light report Green=best, yellow = good, Red = bad).
Based on a prompt/parameter I would like to dynamically switch between
scenario 1) Green >= 80%, Yellow >= 50%, Red < 50%
and
scenario 2) Green >= 50%, Yellow >= 25%, Red < 25%
This is a simplified scenario, currently I have many (20+) conditional blocks each with different color thresholds for different prompt selections.
I was hoping to have 1 block and dynamically set the color thresholds. Is there a javascript solution for this?
Instead of mapping the actual values, create expressions that consider all of the possibilities and map them to a set of numbers you can use for the colors you want to appear. Something like...
if (scenario1) then (
if (what_makes_green) then (1) else (if (what_makes_yellow) then (2) else (if (what_makes_red) then (3) else (whatever)))
) else (
if (scenario2) then (if (what_makes_green) then (1) else (if (what_makes_yellow) then (2) else (if (what_makes_red) then (3) else (whatever))))
)
Nest the if/else constructs as many times as needed. Depending on your conditions, a case statement might make an expression more readable.
Then in your map, it is the usual palette-mapping for the layer.