【问题标题】:How do I format the colour of a cell if the value is NULL in Reporting Services 2008 R2?如果 Reporting Services 2008 R2 中的值为 NULL,如何设置单元格颜色的格式?
【发布时间】:2013-11-26 14:37:56
【问题描述】:

在 Reporting Services 2008 R2 的 Tablix 中,我有以下代码可以根据值更改背景颜色:

=switch(Fields!Mean_Difference.Value > 0,"#DA9694",
        Fields!Mean_Difference.Value = 0,"#FCD5B4",
        Fields!Mean_Difference.Value < 0,"#C4D79B")

但是,当有一个 NULL 值时,它会将其格式化为与 0 相同的颜色,问题是我不希望它被格式化,只是留空。我试过使用 isNothing() 没有运气,似乎找不到答案。

这个可以吗?

【问题讨论】:

    标签: reporting-services switch-statement expression ssrs-2008-r2


    【解决方案1】:

    这行得通吗? (你应该在 ssrs 中使用 Nothing 作为透明背景)。你确定这个值肯定是空的吗?

    =iif(IsNothing(Fields!Mean_Difference.Value)
    ,Nothing
    ,switch(Fields!Mean_Difference.Value > 0,"#DA9694",
        Fields!Mean_Difference.Value = 0,"#FCD5B4",
        Fields!Mean_Difference.Value < 0,"#C4D79B"))
    

    【讨论】:

    • 是的,这个值肯定是 NULL。有用!太好了,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-13
    • 1970-01-01
    • 2011-05-07
    相关资源
    最近更新 更多