Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

ecolomer
Honored Contributor II

Colours

Hi,

I've this script:

Set HidePrefix='%';

Base:

LOAD * INLINE [

    %Color Scheme, Color_A, Color_B, Flag

    Blue, "RGB(52, 152, 219)", "RGB(41, 128, 185)", 1

    Bright Green, "RGB(46, 204, 113)", "RGB(39, 174, 96)", 1

    Orange, "RGB(230, 126, 34)", "RGB(211, 84, 0)", 1

    Red, "RGB(231, 76, 60)", "RGB(192, 57, 43)", 1

    Turquoise, "RGB(26, 188, 156)", "RGB(22, 160, 133)", 1

    Yellow, "RGB(241, 196, 15)", "RGB(243, 156, 18)", 1

    Purple, "RGB(155, 89, 182)", "RGB(142, 68, 173)", 1

    Light Pink, "RGB(224,130,131)","RGB(214,69,65)", 1

    Light Orange, "RGB(242,120,75)","RGB(249,105,14)", 1

    Navy Blue, "RGB(103,128,159)","RGB(52,73,94)",1

    Light Blue, "RGB(134,226,213)","RGB(101,198,187)",1

    Light Purple, "RGB(190,144,212)","RGB(142,68,173)",1

];

And I would like a table of values ​​Color_A and Color_B, addition to make the background color representing value

1 Solution

Accepted Solutions

Re: Colours

Hi,

when I read your post, I thought you had something like color calculations in mind.

Maybe it's not what you're looking for, but nevertheless helps:

QlikCommunity_Thread_133199_Pic2.JPG.jpg

QlikCommunity_Thread_133199_Pic3.JPG.jpg

SET HidePrefix='%';

Base:

LOAD * INLINE [

    %Color Scheme, Color_A, Color_B, Flag

    Blue, "RGB(52, 152, 219)", "RGB(41, 128, 185)", 1

    Bright Green, "RGB(46, 204, 113)", "RGB(39, 174, 96)", 1

    Orange, "RGB(230, 126, 34)", "RGB(211, 84, 0)", 1

    Red, "RGB(231, 76, 60)", "RGB(192, 57, 43)", 1

    Turquoise, "RGB(26, 188, 156)", "RGB(22, 160, 133)", 1

    Yellow, "RGB(241, 196, 15)", "RGB(243, 156, 18)", 1

    Purple, "RGB(155, 89, 182)", "RGB(142, 68, 173)", 1

    Light Pink, "RGB(224,130,131)","RGB(214,69,65)", 1

    Light Orange, "RGB(242,120,75)","RGB(249,105,14)", 1

    Navy Blue, "RGB(103,128,159)","RGB(52,73,94)",1

    Light Blue, "RGB(134,226,213)","RGB(101,198,187)",1

    Light Purple, "RGB(190,144,212)","RGB(142,68,173)",1

];

tabTemp:

CrossTable (ColorName, RGB)

LOAD [%Color Scheme], Color_A, Color_B

Resident Base;

tabColorComponents:

LOAD [%Color Scheme],

    ColorName,

    SubField(TextBetween(RGB,'(',')'),',') as ColorValue,

    Dual(Pick(AutoNumber(RowNo(),AutoNumberHash128([%Color Scheme],ColorName,)),'R','G','B'),

    AutoNumber(RowNo(),AutoNumberHash128([%Color Scheme],ColorName,))) as ColorComponent

Resident tabTemp;

DROP Table tabTemp;

tabColorCalc:

LOAD [%Color Scheme],

    'RGB('&Concat(Color_Sum,' ,',ColorComponent)&')' as Color_Sum,

    'RGB('&Concat(Color_Min,' ,',ColorComponent)&')' as Color_Min,

    'RGB('&Concat(Color_Max,' ,',ColorComponent)&')' as Color_Max,

    'RGB('&Concat(Color_Avg,' ,',ColorComponent)&')' as Color_Avg

Group By [%Color Scheme];

LOAD [%Color Scheme],

    ColorComponent,

    Sum(ColorValue) as Color_Sum,

    Min(ColorValue) as Color_Min,

    Max(ColorValue) as Color_Max,

    Round(Avg(ColorValue)) as Color_Avg

Resident tabColorComponents

Group By [%Color Scheme], ColorComponent;

regards

Marco

9 Replies

Re: Colours

Can you give bit more idea about what you want please?

i.e. how you want to use them?

danieloberbilli
Valued Contributor II

Re: Colours

this should work:

=$(=Only(Color_A))

ecolomer
Honored Contributor II

Re: Colours

Is only a test

In this moment works only if I select a color, but not in a box list or

Re: Colours

In case of different Flag defined for each color...

=$(=Only({<Flag = {2}>}Color_A))

danieloberbilli
Valued Contributor II

Re: Colours

Try something like this:

Capture2.PNG.png

Capture1.PNG.png

Re: Colours

Hi,

when I read your post, I thought you had something like color calculations in mind.

Maybe it's not what you're looking for, but nevertheless helps:

QlikCommunity_Thread_133199_Pic2.JPG.jpg

QlikCommunity_Thread_133199_Pic3.JPG.jpg

SET HidePrefix='%';

Base:

LOAD * INLINE [

    %Color Scheme, Color_A, Color_B, Flag

    Blue, "RGB(52, 152, 219)", "RGB(41, 128, 185)", 1

    Bright Green, "RGB(46, 204, 113)", "RGB(39, 174, 96)", 1

    Orange, "RGB(230, 126, 34)", "RGB(211, 84, 0)", 1

    Red, "RGB(231, 76, 60)", "RGB(192, 57, 43)", 1

    Turquoise, "RGB(26, 188, 156)", "RGB(22, 160, 133)", 1

    Yellow, "RGB(241, 196, 15)", "RGB(243, 156, 18)", 1

    Purple, "RGB(155, 89, 182)", "RGB(142, 68, 173)", 1

    Light Pink, "RGB(224,130,131)","RGB(214,69,65)", 1

    Light Orange, "RGB(242,120,75)","RGB(249,105,14)", 1

    Navy Blue, "RGB(103,128,159)","RGB(52,73,94)",1

    Light Blue, "RGB(134,226,213)","RGB(101,198,187)",1

    Light Purple, "RGB(190,144,212)","RGB(142,68,173)",1

];

tabTemp:

CrossTable (ColorName, RGB)

LOAD [%Color Scheme], Color_A, Color_B

Resident Base;

tabColorComponents:

LOAD [%Color Scheme],

    ColorName,

    SubField(TextBetween(RGB,'(',')'),',') as ColorValue,

    Dual(Pick(AutoNumber(RowNo(),AutoNumberHash128([%Color Scheme],ColorName,)),'R','G','B'),

    AutoNumber(RowNo(),AutoNumberHash128([%Color Scheme],ColorName,))) as ColorComponent

Resident tabTemp;

DROP Table tabTemp;

tabColorCalc:

LOAD [%Color Scheme],

    'RGB('&Concat(Color_Sum,' ,',ColorComponent)&')' as Color_Sum,

    'RGB('&Concat(Color_Min,' ,',ColorComponent)&')' as Color_Min,

    'RGB('&Concat(Color_Max,' ,',ColorComponent)&')' as Color_Max,

    'RGB('&Concat(Color_Avg,' ,',ColorComponent)&')' as Color_Avg

Group By [%Color Scheme];

LOAD [%Color Scheme],

    ColorComponent,

    Sum(ColorValue) as Color_Sum,

    Min(ColorValue) as Color_Min,

    Max(ColorValue) as Color_Max,

    Round(Avg(ColorValue)) as Color_Avg

Resident tabColorComponents

Group By [%Color Scheme], ColorComponent;

regards

Marco

ecolomer
Honored Contributor II

Re: Colours

Brilliant

Yes you are read my mind.....!!!

TX

Re: Re: Colours

maybe like this also?:

QlikCommunity_Thread_133199_Pic4.JPG.jpg

hope this helps

regards

Marco

Re: Re: Colours

you're welcome

regards

Marco

Community Browser