Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
andreas_koehler
Creator II
Creator II

Problem with format-code in Num() in expression

Hi!

This is about colorcoding a simple table with If-clauses in the expression field of the background color and using variables to adapt the limits.

It did not work out and I wonder why?

As this works:

If( [Ratio] >= 0.1, LightBlue(),

     If([Ratio] >= -0.1, Green(),

LightMagenta()))

this does not:

If(

[Ratio] >= Num($(vBlockCColorBound),'#,##',','), LightBlue(),

     If([Ratio] >= Num($(vBlockCColorBoundLow),'#,##',','), Green(),

LightMagenta()))

with

vBlockCColorBound = 0,1

vBlockCColorBoundLow = -0,1

Seems that I always get a 0 as result of both Num().

[Ratio] is the label of the expression I want to colorcode.

Both valuables are in the end defined by users via sliders with German number conventions (DecimalSep=',') that should not be changed.

11 Replies
marcus_sommer

At first if you want to change the decimal-sign you need to apply the num-function with all 3 format-parameter. But the decimal-sign which you applied within the first parameter '#,##' isn't relevant because it will be changed with the second parameter which must be then '.'. If you used my suggestion from above:

= num(vTest, '#,##', '.', ',') // vTest: 0,1

it will work.

- Marcus

andreas_koehler
Creator II
Creator II
Author

Marcus,

you are right, it works:

If( [Ratio] >= Num(vBlockCColorBound,'#,##','.',',') , LightBlue() ...

What also worked was Sébastien's proposal with a slight change:

If(

[Ratio] >= Num#('$(vBlockCColorBound)','#,##','.',',') ,

I also tested Sadi's proposal, but is sadly did not work well, even with some variations.

If(

Num([Ratio],'#,##',',') >= Num($(vBlockCColorBound),'#,##',',') ,

but is sadly did not work well, even with some variations.

Thank you all!