Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

rgb function inline table

Hi All,

I have created an inline table that includes a mapping between a certain type and a color.

The table looks like below:

load * inline [

Type,ColorMapping,

T,rgb(255,255,155)

A,rgb(255,155,255)

];

and I am trying to map the background color of the expression with the type of the field, but it does not seem to work.

My expression is

=Only

(

  If(Type<>'N/A',

     If(Left(Type,1)='H','H',Type))

)

and the calculated expression on the background color is =ColorMapping

Any ideas why??

1 Solution

Accepted Solutions
iktrayanov
Creator III
Creator III

Try this

load * inline [

Type,X,Y,Z

T, 255,255,155

A, 255,155,255

];

background color is =RGB(X,Y,Z)

View solution in original post

4 Replies
Not applicable
Author

Hey Nikos,

Hope this helps.

Thanks

AJ

Clever_Anjos
Employee
Employee

Something like this loading your RGB values as string and using RGB (or ARGB) function to convert to a number

LOAD

  proposta_status,

  proposta_status_ordem,

  rgb(SubField(proposta_status_cor,',',1),SubField(proposta_status_cor,',',2),SubField(proposta_status_cor,',',3))  as proposta_status_cor

INLINE [

    proposta_status, proposta_status_ordem, proposta_status_cor

    Novo, 1, "170,170,170"

    Em Análise, 2, "255,153,0"

    Proposta Enviada, 3, "204,255,255"

    Em Negociação, 4, "255,255,0"

    Ganho, 5, "153,204,0"

    Perdido, 9, "255,0,0"

];

iktrayanov
Creator III
Creator III

Try this

load * inline [

Type,X,Y,Z

T, 255,255,155

A, 255,155,255

];

background color is =RGB(X,Y,Z)

Not applicable
Author

Hi Nikos, the comma (,) treated as delimiter in the INLINE table. so Please try like below:

LOAD ID , RGB(R,G,B) AS BG INLINE [

ID, R, G, B

1001, 10,35, 80

2001, 100, 255, 180

3001, 255, 135, 245

];