有条件地格式化Tablix的某些单元格

问题描述 投票:1回答:1

使用Visual Studio 2017(SSDT),我有一个Tablix,我想在其中使用表达式来设置背景颜色/填充。我希望单元格在其中填充灰色:

  1. 2019年金属为银,2020年金属为铜,或
  2. 2019年金属为金,2020年金属为青铜,或
  3. 2019年金属为金,2020年金属为银。

外观上像这样:

enter image description here

填充Tablix的数据集是:

enter image description here

((我添加了自定义“ Is Null”代码来显示零。)

我一直在尝试IIF语句逻辑,但无法获得所需的结果。

tablix的设计是:

enter image description here

我正在尝试使用表达式在此处设置文本框的Fill BackgroundColor:

enter image description here

...使用类似的东西:

=IIF(
Fields!METAL_YEAR_2020.Value="Bronze" AND 
  (Fields!METAL_YEAR_2019.Value = "Silver" OR Fields!METAL_YEAR_2019.Value = "Gold")
, "Gray"
, "Transparent"
)

如果不考虑OR条件,我可以填充一个预期的单元格,但是我不知道如何解释这三个单元格。

所以,下面的这段代码设置了一个单元格,但是我可以嵌套或SWITCH设置我想要的三个单元格吗?

= IIF(
       (
           (Fields!METAL_YEAR_2019.Value = "Silver" and Fields!METAL_YEAR_2020.Value = "Bronze")
        OR (Fields!METAL_YEAR_2019.Value = "Gold"   and Fields!METAL_YEAR_2020.Value = "Bronze")
        OR (Fields!METAL_YEAR_2019.Value = "Gold"   and Fields!METAL_YEAR_2020.Value = "Silver")
       )
, "Gray", "White")

enter image description here

reporting-services ssrs-tablix
1个回答
0
投票

因为没有数据可获取空值(不仅不存在整数值,而且所有值都必须引用文本框中的组值)

= iif(
(cstr(ReportItems!Metal_2019.Value) = "Silver" AND cstr(ReportItems!Metal_2020.Value) =     "Bronze") OR
(cstr(ReportItems!Metal_2019.Value) = "Gold"   AND (cstr(ReportItems!Metal_2020.Value) = "Silver" OR cstr(ReportItems!Metal_2020.Value) = "Bronze")),
"Gray","Transparent")

found at

© www.soinside.com 2019 - 2024. All rights reserved.