Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
Thanks a lot, it works.