【问题标题】:Background color is not working if no data in database in ssrs matrix report如果 ssrs 矩阵报告中的数据库中没有数据,则背景颜色不起作用
【发布时间】:2020-01-07 12:35:35
【问题描述】:

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

当我们有值而不是背景颜色时,如果没有数据背景颜色不工作

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

【问题讨论】:

  • 如果没有值,则矩阵中不可能有背景色;没有数据。这就像说您希望文本是蓝色的,但是当没有文本时,您仍然希望文本在视觉上是蓝色的。没有文字,文字怎么会是蓝色的?
  • 什么是替代解决方案?
  • 替代什么?当没有行时,您也不能交替颜色。这回答了你的问题了吗? Add alternating row color to SQL Server Reporting services report
  • 是的,如果没有行/值比不能做任何事情,你是对的,谢谢@Larnu
  • 尝试=iif(rownumber(nothing) mod 2 = 0, "color1","color2")作为行背景颜色。

标签: reporting-services ssrs-2017


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-27
    • 1970-01-01
    • 1970-01-01
    • 2011-10-09
    相关资源
    最近更新 更多