Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'd like to set the background color of a cell by means of a parametric variable.
My variables are:
ClasseA = RGB (128,255,128)
ClasseB = RGB(255,255,128)
The field ClassComp can have the values of A and B and I'd like to set its background color using the variable ClasseA (when the ClasseComp value is 'A') and the variable ClasseB when the ClasseComp value is 'B'
How can I set the background value using the variables ClasseA and ClasseB parametrically?
I've tried with =$(Classe & ClasseComp) but it doesn't work...
Obviously in this example I used only A and B, but my classes are from A to Z, so I dont't like to use 26 nested if.
Thank you.
N.
Hi,
perhaps an inline load in the script would help you?
For example:
A:
LOAD * INLINE [
Class, Red, Green, Blue
A, 128, 255, 128
B, 255, 255, 128
C, 120, 120, 120
];
Then, you can set the colour:
RGB(Red, Green, Blue)
Regards
Hi,
perhaps an inline load in the script would help you?
For example:
A:
LOAD * INLINE [
Class, Red, Green, Blue
A, 128, 255, 128
B, 255, 255, 128
C, 120, 120, 120
];
Then, you can set the colour:
RGB(Red, Green, Blue)
Regards
I defined vClass = 'Class'
and vClassA = rgb(128,255,128)
and vClassB = rgb(255,255,128)
and vComp = A
Then I can use
=$(=$(vClass)&vComp)
in the Background of Expression and it gets me the Color
Instead of variable vComp it should be your field with values A to Z
Well...I'm in trouble with the syntax by using the fields:
=$(=$(vClasse)&ClasseComp)
returns only the value 'Classe' (the value of the variable vClasse)
Would you mind to post the right syntax?
Thanks.
N.
Does it work if you put a listbox with field ClasseComp on the sheet, and select a single value in the listbox?
Sorry, I didnot get it work with a field
I suppose that the Problem that the Expression is calculated only once
using an Aggregation function or select a value makes it work
also using If Statement (IF ClassComp='A' etc. makes it work
But with fields which can contain more than 1 value , I didnot get it work
So the solution that Alex presented would fix the problem with dynamic coloring in tables. Just change the colors in his INLINE table, and rename column Class to ClassComp.
Then add an expression =rgb(Red, Blue, Green) to every cell that needs coloring and that belongs to a row with a single ClassComp value.
Thank you so much for the solution, and thanks also to everybody for the help.
N.