last year this question was answered here http://community.qlik.com/message/17746#17746 with "no" in terms of direct hex-input. But you can always convert hexadecimal colors to RGB using different tools - online calculators (for example here: http://drpeterjones.com/colorcalc/) or self-written functions (for example here: http://community.qlik.com/message/33594#33594).
may I ask why? you have to split up your hexadecimal color - first two digits for R, next two for G, last two for B. Calculation as implemented by Hector Munoz...
you can translate your hex colors to RGB and use syntax similar to the following:
If(Avg(%Field) = 1, RGB(142,158,130), If(Avg(%Field) = 2, RGB(202,204,182), ...etc.
or you could make variables using the RGB function and write it like this instead:
If(Avg(%Field) = 1, $(vGreenDk), If(Avg(%Field) = 2, $(vGreenLt), ...etc.
or you could put the HEX value straight into your expression as follows:
If(Avg(%Field) = 1, '#8E9E82', If(Avg(%Field) = 2, '#CACCB6', ...etc.
dollar sign expansion on the second method is not necessary, just best practices.
simple formula: Num#('FF' & vHexColor,'(HEX)')
Use 6 hex digits in the place of vHexColor in the above formula.e.g AABBCC would be
In QlikView the color representation is 4 bytes long, where the first byte is the transparency. If you dont want transparancy then - like in the above example - start with "FF" and then put the rest of your Hex Color Code. The result is a valid color in QlikView.
(Hi avifarkashwould be nice if you mark this thread as "answered" ...)
Like this only
NOTE: HEXCODE should not contain '#' , if you have # then also add Purgechar()
=RGB(num(num#(left(HEXCODE,2),'(HEX)')) ,num(num#(mid(HEXCODE,3,2),'(HEX)')) ,num(num#(right(HEXCODE,2),'(HEX)')))
=RGB(num(num#(left(purgechar(HEXCODE,'#'),2),'(HEX)')) ,num(num#(mid(purgechar(HEXCODE,'#'),3,2),'(HEX)')) ,num(num#(right(purgechar(HEXCODE,'#'),2),'(HEX)')))
Christof is correct. A colour value is simply a 32 bit (4-byte) number. Any expression which returns a 32 bit number can be used as a colour expression. RGB() and ARGB() also return a 32 bit number.
Splitting the hex number to feed into RGB() is messy and unnecessary. Use Christof's formula instead or a suitable adaptation to your requirements.