Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Partner
Partner

Color mix wizard not working with 3 points?

Hi,

I want to generate colors between 3 points based in a variable value so I created a variable called test, and I set this variable 0.5 value.


And for generate those colors I used the color mix wizard:

>0.8 --> Green

0.5 --> Orange

<0.25 --> Red

So this is the wizard result expression:

=ColorMix2 (

  if(rangemin(0.8,rangemax($(test),0.2))<0.5,

  -Sqrt(-(rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.5-0.2)),

  Sqrt((rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.8-0.5))

  )

  , ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 128, 64))

I just wanted to check if it works, so I put this expresion i a text box, and tested some the values in a data entry, I just realized that if the number is < 0.8 it works and each time return a color between 0.8 and 0.25, but if the number is greater than 0.8 return null ( - ).

So I checked the 2nd expression in the if statement in a text box:

     =Sqrt((rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.8-0.5))

And returns: 1

I tried to comment the below expression and add a 1 in them:

=ColorMix2 (

  if(rangemin(0.8,rangemax($(test),0.2))<0.5,

  -Sqrt(-(rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.5-0.2)),

  1//Sqrt((rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.8-0.5))

  )

  , ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 128, 64))

Return: ARGB(255,0,255,0)

????

Ok, maybe there's something wrong and I cant access to that value, so I tried with $(= .... 😞

=ColorMix2 (

  if(rangemin(0.8,rangemax($(test),0.2))<0.5,

  -Sqrt(-(rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.5-0.2)),

  $(=Sqrt((rangemin(0.8,rangemax($(test),0.2))-0.5)/(0.8-0.5)))

  )

  , ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 128, 64))

  , ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 128, 64))

Return: ARGB(255,0,255,0)

Ok, It works! But I tried some other numbers in between and it crash again!

     Now:

         - Between 1 and 0.8  it works!

         - From 0.8 to 0.6, doesn't works and return somethink like:

        "Error: Error in expression: If takes 2-3 parameters"

        - From 0.59 to 0, it works!

    

Argg!! Maybe there is an issue with the colomn inside, so I tried to do some replace between ,  and  .  , and it solves this problem but I have anothers...

But anyway, this comes from the wizard itself.. so any Idea why this happens? With only 2 points, the wizard, works perfectly.. but with 3 I think there is something wrong (I can't imagine what I did wrong in the wizard steps..)

Thanks!

David,

P.D: I'm using Qlikview Desktop 11.20 SR2