Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for Data Integration and Data Analytics gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Font color in expression

Hi

This code works fine (it just make a format so numbers under one percent show a decimal, else show a interger) - but I want the code to change the font color as well - how do I do that?

=

if ((

SUM({1<Year={$(v_year)}>} DKK))/ (SUM({1<Year={$(v_year)}>} TOTAL DKK))<0.01, NUM((SUM({1<Year={$(v_year)}>} DKK))/ (SUM({1<Year={$(v_year)}>} TOTAL DKK)), '#.##0,0%') ) &

if ((

SUM({1<Year={$(v_year)}>} DKK))/ (SUM({1<Year={$(v_year)}>} TOTAL DKK))>=0.01, NUM((SUM({1<Year={$(v_year)}>} DKK))/ (SUM({1<Year={$(v_year)}>} TOTAL DKK)), '#.##0%') )

Can I add a font style?

Thanks in advance 🙂

(By the way my code is used in the Ideovision Map extension, but I think its a common issue for all expressions)

15 Replies
Highlighted
Contributor II
Contributor II

Re: Font color in expression

I'm sorry, but is the regular text formatting not available? is this code from your expression?

Can you not create similar if statement in the Text Color formatting expression?

font.png

ex.

=if(<your condition>,White(),Black())

or multiple if statements if you need more of a gradient

=if(<your condition>,White(),

       if(<your condition>, rgb(34,255,34),

            if(<your condition>, rgb(224, 224, 224),

                )

             )

          )

Highlighted
Not applicable

Re: Font color in expression

Thanks - but in the extension idevio I can only work in the webview and there is no access to the regular text formatting thats why I want to do in my expression 🙂 So unfortunately I cant use your suggestion, but thanks anyway for trying 🙂

Highlighted

Re: Font color in expression

I think in the extension you need have the code to handle the font size I guess ..Since you have the extension add the code to handle the font color in the extension that way you will have more option 

Highlighted
Not applicable

Re: Font color in expression

well its not a general change - I want to control the font color for the label by an IF-statement. I know I can't use NUM-function, because this only format the numbers. Therefore: I can't find a function to handle font color when I want to write my IF statement in the expression in the label fx-box.

Highlighted

Re: Font color in expression

So your label is a combination of text and num? then we don't have a way to handle that ..could give an example

if its only the numbers then something like this would work

if(exp>1.0 , RGB(245,36,65), if(exp=100,RGB(),RGB()))

Highlighted
Not applicable

Re: Font color in expression

Thanks - great feedback - now its close to success, but no cigar yet 🙂

Now the labels are not longer numbers but a textstring: RGB(245,36,65) ... and the textstring code changes along with the if-statement. Thats ok, but code dont execute the RGB to a color, so I read my label in the color ... do you have any suggestion to get through that hurdle? Thank you so much in advance 🙂

My wish is that I can change the label color at the area white dark background color at the maps below 🙂
(and it changes over time, that why I want to control it with the IF-statement)

udklip1.JPG

Highlighted

Re: Font color in expression

You need to paste the color expression in the Expression tab>+ mark and paste it hear and the regular expression in the expression definition box so it actually to different location

Highlighted
Not applicable

Re: Font color in expression

I really appreciate your help - but Im not sure what you mean. I use the expression box at the [LABEL] section:

Udklip2.JPG


And the simple test of color

=if((SUM({1<Year={$(v_year)},Fou_geo={'DK'}>} DKK))/ (SUM({1<Year={$(v_year)},Fou_geo={'DK'}>} TOTAL DKK))<0.01, RGB(245,36,65), RGB(245,245,245))

This gives the picture in shown in my recent post ... Do you think Im writing the code at the wrong place?

Highlighted

Re: Font color in expression

This is the palace to define your label name their will be an option to choose the Label font color , their you need paste the RGB() if condition expression to pick the color

Hope you got the answer