Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an expression to change background color of a cell on
=If([Technology Status]='AAA',lightgreen()) -
works fine but I do have multiple statuses so I want to color them in different colors.
Such as:
=If([Technology Status]='XYZ',lightblue()) and
=If([Technology Status]='xxx',red()) and so on
How do I use nested if or is there any better way? Thanks, yury
Hi ypritzke, look at my piece of code. It works fine to me.
if( Status = 'Completed',
green(),
if( Status = 'Completed with warning',
yellow(),
if( Status = 'Completed with errors',
red(),
if( Status = 'Not planned',
RGB(255,100,0),// arancione
if( Status = 'Not started',
red(),
white()
)
)
)
)
)
I don't have access to QV at the moment but dont forget how the 'if' statement is constructed:
if (conditional statement, true, false)
so you nest an if like:
If([Technology Status]='AAA',lightgreen(), If([Technology Status]='XYZ',lightblue(), if (......)))
Regards,
Gordon
I tried this, does not work, even the first if stoped working.
are you sure you wrote the expression in the expanded part of the expression (push the '+') called 'Background color'?
Just writing this in the normal expression wont work.
Yes, it is an expression of a Background color
Hi ypritzke, look at my piece of code. It works fine to me.
if( Status = 'Completed',
green(),
if( Status = 'Completed with warning',
yellow(),
if( Status = 'Completed with errors',
red(),
if( Status = 'Not planned',
RGB(255,100,0),// arancione
if( Status = 'Not started',
red(),
white()
)
)
)
)
)
Thank you. it worked. I did not have very last altrenative like white() in your case
Well done. I liked it.
Another option:
pick(match("Technology Status",'AAA' ,'XYZ' ,'xxx',...)
lightgreen(),lightblue(),red(),...)
And another:
StatusColors:
LOAD * INLINE [
Technology Status,R,G,B
AAA,50,255,50
XYZ,50,50,255
xxx,200,0,0
...
];
rgb(R,G,B)
Hi John,
I am interested in your inline table for background coloring. I have a large table of activities which need to have a different color for every activity ( fixed colors by activities ), and using nested if in the expression causes the app to run very very slow . I guess your solution of the inline table in the script will make the app to run better. What expression do you enter for the background color ? just this one ?: =RGB(R,G,B) ?
THANKS