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

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
reddy-s
Master II
Master II

Hi Gus,

Consider this as an example for properties panel,

definition: {

  type: "items",

  component: "accordion",

  items: {

  dimensions: {

  uses: "dimensions",

  min: 1,

  max: 1

  },

  measures: {

  uses: "measures",

  min: 1,

  max: 1,

                  items : {

                    xrefValue : {

                            type  : "string",

                            label : "Colour Expression",

                            ref   : "qAttributeExpressions.0.qExpression",

                     expression: "always"

                        }

                   

                  }

  },

  sorting: {

  uses: "sorting"

  },

  settings: {

  uses: "settings"

                 

  }

  }

  },

  snapshot: {

  canTakeSnapshot: true

  }

Thanks,

Sangram

czchuaibizcs
Contributor
Contributor

Hi Reddys,

How should I write the code in paint:function after I done showing the expression input box in properties panel?

Thanks in advance!