IcCube报告,有条件着色行

时间:2017-05-03 16:35:08

标签: adhoc iccube-reporting

使用IcCube报告V6,我知道如何根据列的值(或列列)调整表格的单元格颜色。

enter image description here

有没有办法根据它的标签有条件地为一个完整的行着色? 例如,如果它的标签是“服务器”,或者可能只是该行的值,我想将该行涂成红色。

enter image description here

我想起点是使用“Ad-Hoc Expression”类型的Cell Renderer,但我不知道如何编写它。

enter image description here

1 个答案:

答案 0 :(得分:1)

在IcCube 6.2中有几种方法可以做到这一点:

Ad-Hoc Expression

有可能使用表达式作为过滤器函数将整个单元格渲染器应用于单元格/行/列

在这种特殊情况下,您可能希望使用(它完全符合" true" 字符串):

return context.rowLabel() == 'Server' ? 'true' : 'false'

icCube 6.2(4217)+

返回值可以是" true" true

return context.rowLabel() == 'Server'

Demo report

颜色表达

如果您唯一的目标是更改所选单元格/行/列的背景/文本颜色,则可能需要使用颜色表达式:

if(context.rowLabel() == 'Server'){
    return "#f2a2a5"
}

return null

enter image description here