Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
reema_dangwal
Contributor
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_s
Partner - Creator II
Partner - Creator II

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

View solution in original post

2 Replies
m_s
Partner - Creator II
Partner - Creator II

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
Contributor
Contributor
Author

Thanks a lot, it works.