Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
reema_dangwal
New Contributor

Qliksense Mashup - Visualization on the Fly

Hi All,

I am creating a table object using app.visualization.create( 'table'.......,  Can you please suggest how to add text color expression to the measure values in this object.

Example if my code is:

app.visualization.create( 'table', [ "Case Owner Group", { "qDef" : { "qDef" : "Avg([Case Duration Time])", "qLabel" : "Avg Case Duration Time" }, }, { "qDef" : { "qDef" : "Sum( [Open Cases] )", "qLabel" : "Open Cases" } } ], {"title" : "Case Owner Group Case stats"} ).then( function ( visual ) { visual.show( 'QV01' ); } );

How can I mention the option of color in code so that if the expression is Avg([Case Duration Time])<5 then the text color should be red otherwise green for the same column/expression.

Thanks,

Reema

1 Solution

Accepted Solutions
m_schindler
Contributor II

Re: Qliksense Mashup - Visualization on the Fly

Hello Reema,

please try adding an expression to the measures "qAttributeExpressions":

app.visualization.create('table', ["Case Owner Group",

{

  "qAttributeExpressions": [{ "id":"cellForegroundColor", "qExpression": "=Green()" }], 

"qDef": {

"qDef": "Avg([Case Duration Time])",

"qLabel": "Avg Case Duration Time"

},

},

{

"qAttributeExpressions": [{ "id":"cellForegroundColor", "qExpression": "=Red()" }],

"qDef": {

"qDef": "Sum( [Open Cases] )",

"qLabel": "Open Cases"

}

}

], {

"title": "Case Owner Group Case stats"

}).then(function (visual) {

visual.show('QV01');

});

Mathias

2 Replies
m_schindler
Contributor II

Re: Qliksense Mashup - Visualization on the Fly

Hello Reema,

please try adding an expression to the measures "qAttributeExpressions":

app.visualization.create('table', ["Case Owner Group",

{

  "qAttributeExpressions": [{ "id":"cellForegroundColor", "qExpression": "=Green()" }], 

"qDef": {

"qDef": "Avg([Case Duration Time])",

"qLabel": "Avg Case Duration Time"

},

},

{

"qAttributeExpressions": [{ "id":"cellForegroundColor", "qExpression": "=Red()" }],

"qDef": {

"qDef": "Sum( [Open Cases] )",

"qLabel": "Open Cases"

}

}

], {

"title": "Case Owner Group Case stats"

}).then(function (visual) {

visual.show('QV01');

});

Mathias

reema_dangwal
New Contributor

Re: Qliksense Mashup - Visualization on the Fly

Thanks a lot, it works.