首页 > 解决方案 > 如果 ssrs 矩阵报告中的数据库中没有数据,则背景颜色不起作用

问题描述

在此处输入图像描述

我已经建立了具有 2 个参数的矩阵报告,一个是单独的,另一个是级联参数

当我们的值比背景颜色有效但如果没有数据背景颜色无效

即使数据库中也没有数据,是否有任何解决方案可以应用

标签: reporting-servicesssrs-2017

解决方案


我们也可以在矩阵报告中应用背景颜色,这里是链接可以参考

[SQL Server Reporting Services Tablix 和 Matrix 中的备用行背景颜色]

https://www.mssqltips.com/sqlservertip/3490/alternate-row-background-color-in-sql-server-reporting-services-tablix-and-matrix/

The above link is helpful to apply alternate background color to the records/fields

If we want to apply back ground color for specific records than specific records than 
have to modify the below expression like:

这里的数字,如 964、5003 等,是基于可以将背景颜色应用于特定记录的序列号/行号

  =Switch(VAL(ReportItems!ROWCOLOR.Value)=964, "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=5003,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=5337,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=6241,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=8561,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=8673,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=13282,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=13775,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=1211,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=7361,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=7746,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=8556,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=10846,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=10994,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=13290,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=2243,   "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=2607,   "#D9D9D9"
    )

我创建了一组“Group1”并右键单击文本框并编写表达式:RowNumber(nothing) 以生成序列号

我在一组中写了数字 1

在下图中,表达式的第一个字段包含 RowNumber(nothing)

https://i.stack.imgur.com/kGCue.png

https://i.stack.imgur.com/swlo4.png

https://i.stack.imgur.com/OpvAh.png

https://i.stack.imgur.com/stUn1.png

https://i.stack.imgur.com/8gaiG.png

https://i.stack.imgur.com/CJI9f.png

https://i.stack.imgur.com/d75Zd.png


推荐阅读