SSRS Alternating row color issues when some rows are not visible

徘徊边缘 提交于 2019-12-12 00:29:46

问题


I have a report where I have a customerID group, and no detail group. The dataset that I have going to the report will have each customer, as well as numerous columns of information for that customer. I have created a bunch of rows, that are labeled appropriately, and displays valid data associated with it (ex. Age: 34, Sex: Male). I also have some rows where the data coming back may be blank or NULL. These rows I choose to hide the visibility for. I am unsure how to handle the alternating background color, because there's always going to be some rows that are not visible, but you can't predict which ones they will be. If I had the data unpivoted in the dataset, I could just eliminate the rows that would not be visible, and just display the rows with a detail grouping and do the RowNumber Mod solution. I was hoping there's an easy way to do this the way that I currently have it set up though. Is there a way to check the background color of the previous visible row? Set a report variable to the color of what the next visible row should be?


回答1:


Try using the Alternating Row Color code instead of the ROWNUMBER.

Private bOddRow As Boolean
'*************************************************************************
' -- Display green-bar type color banding in detail rows
' -- Call from BackGroundColor property of all detail row textboxes
' -- Set Toggle True for first item, False for others.
'*************************************************************************
Function AlternateColor(ByVal OddColor As String, _
         ByVal EvenColor As String, ByVal Toggle As Boolean) As String
    If Toggle Then bOddRow = Not bOddRow
    If bOddRow Then
        Return OddColor
    Else
        Return EvenColor
    End If
End Function

Set the BackgroundColor of your row cells with

=Code.AlternateColor("AliceBlue", "White", True)

Add alternating row color to SQL Server Reporting services report



来源:https://stackoverflow.com/questions/32106143/ssrs-alternating-row-color-issues-when-some-rows-are-not-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!