Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

guster999
New Contributor II

can a text box in Qlik Sense be given conditional font colour settings?

I have been using the fx feature of adding a measure to a text box which is great, but I also want to color code these outputs for red as negative, green as positive numbers.  Is this poss to control with the code?

An example of one of my measures is below:

(sum({<BudVsAct={"Budget"} ,ExpVsRev={"Expense"},  [Cost Centre]={23} >}[Period Balance])

-sum({<BudVsAct={"Actual"} ,ExpVsRev={"Expense"},  [Cost Centre]={23} >}[Period Balance]))/1000

And a get a text box with a combination of text and functions as per attached file, but I don't want to have to manually change the color to either red or green each month? 

Thanks

Gus

11 Replies
ogster1974
Honored Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

could you use a KPI or gauge object instead of text box ? its the ideal object for this type of content with built in colour switching.

reddys310
Honored Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Hi Gus,

As Andy mentioned you can make use of a KPI to achieve. But if you have a very big text to change colour conditionally then you cannot use the KPI nor the text object. In this case, you need to go with an extension to achieve it.

Thanks,

Sangram.

guster999
New Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Yes I have used KPI’s for some key measures, but the text box is to cover a lot more detail and it needs to be in sentence form to fit the page.

I will look out for a possible extension to help with this.

Many thanks for your replies.

reddys310
Honored Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Yes Qlik branch should be the place for you and if you haven't found anything interesting, let me know and I will help you build one.

Thanks,

Sangram.

guster999
New Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Hi Sangram,

I cannot find an extension for this, but would be interested to know about building one?

Many thanks

Gus

reddys310
Honored Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Hi Gus,

Go through the API documentations here:

https://help.qlik.com/sense/2.0/en-us/developer/

Thanks,

Sangram

guster999
New Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Thanks Sangram,

I have been into the workbench area and seen the javascript for other extensions I have, and also tried the hello world example as a new extension that now pops up in my Qliksense apps.

But as to the actual coding required to get conditional coloring in a text box – I’m not sure even how to begin the coding for this?

Cheers

Gus

reddys310
Honored Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Hi Gus,

Have a colour coding expression input box for the dimension or measure input like this:

Capture.PNG

So you can colour code the expression based on that.

Thanks,

Sangram.

guster999
New Contributor II

Re: can a text box in Qlik Sense be given conditional font colour settings?

Yes thanks Sangram, I can see what output I need from this, are there examples of the javascript needed to create a text box with this colour expression input feature added?

Community Browser