Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a Sankey chart with a bunch of nodes that I want to assign different colors. I could probably do it in a pinch with nested if statements, but that's an ugly ugly kludge. What I want to do is use a Switch statement like you would in just about any other programming language... like this:
SWITCH
CASE 'A' Red();
CASE 'B' Blue();
CASE 'C' Green();
DEFAULT Black()
END SWITCH
Does anyone know why SWITCH isn't available for color expressions? Or if there's a switch-like statement that I'm not finding?
Check if you can use Pick function. If requires n as integer
pick(n, expr1[ , expr2,...exprN])
pick(numcolor, Red(),Blue(),Green(),Black())
where numcolor = 1,2,3,4..
1 will return Red()
2 will return Blue()
3 will return Green()
4 will return Black()
Check the help for more details
You can use pick() with match() on the node dimension:
=pick(match([Encounter Outcome],'Positive','Presumed Recovered','Recovered','Expired','Self Isolated'),'#FF0000','#00C016','#00FF40,'#C0C0C0','#0000FF')