我有一些問題獲得交替行顏色。組內SSRS交替行顏色
我已經嘗試了不同的表情,正如我已經得到了得到它這樣做是接近:
=IIF(RunningValue(Fields!agent_name.Value,CountDistinct, Nothing) MOD 2 = 1, "Gainsboro", "White")
所有其他的我的報告得到正確的ALT排陰影,我有麻煩與具有行組和列組..用了大概2天,仍然沒有運氣:(
我的行組顯然是名字,
欄目組是月/年。
任何建議/協助將不勝感激
我有一些問題獲得交替行顏色。組內SSRS交替行顏色
我已經嘗試了不同的表情,正如我已經得到了得到它這樣做是接近:
=IIF(RunningValue(Fields!agent_name.Value,CountDistinct, Nothing) MOD 2 = 1, "Gainsboro", "White")
所有其他的我的報告得到正確的ALT排陰影,我有麻煩與具有行組和列組..用了大概2天,仍然沒有運氣:(
我的行組顯然是名字,
欄目組是月/年。
任何建議/協助將不勝感激
的問題是,有在數據的NULL其中矩陣是創造細胞不存在的數據。由於沒有與這些單元關聯的Agent_Name,它們默認爲白色。
我放棄了使用SSRS捉迷藏價值觀和行號,通常使用交替行顏色的功能。
你添加一些VB代碼報告(報告屬性>碼):
Private bOddRow(10) As Boolean
Function AlternateColor(ByVal OddColor As String, ByVal EvenColor As String, ByVal Toggle As Boolean, ByVal Type AS INTEGER) As String
If Toggle Then bOddRow(Type) = Not bOddRow(Type)
If bOddRow(Type) Then
Return OddColor
Else
Return EvenColor
End If
End Function
然後使用表達式來填充顏色:
=code.AlternateColor("AliceBlue", "White", 0, 1)
前兩個參數是交替的顏色,第三個參數是告訴它切換顏色的控件,第四個參數是用於嵌套分組的組。
的行的第一列具有與第一控制。其中有您的代理機構名稱 -
=code.AlternateColor("AliceBlue", "White", 1, 1)
在第一列使用此。
How to create Alternative Row Background colors in SSRS for values in a group
Necromancing。
接受的答案對我來說不起作用,因爲在列分組內非常不規則。
但是,下面的代碼工作。
您需要設置背景顏色在第一個單元格爲
=iif(Code.IncrementRunningValue() Mod 2 = 0, "WhiteSmoke", "White")
而且在隨後的所有細胞
=iif(Code.GetRunningValue() Mod 2 = 0, "WhiteSmoke", "White")
將其設置爲組變量是行不通的,因爲應用了排序在分組之後(這意味着在生成值之後重新排列行)。
Private m_s_count As ULong = 0
Public Function IncrementRunningValue() As ULong
m_s_count = m_s_count + 1UL
Return m_s_count - 1UL
End Function
Public Function GetRunningValue() As ULong
Return m_s_count
End Function
或者你也可以做到這一點更簡單:
Private m_s_AlternatingColor1Count As ULong = 0
Private Function ComputeAlternatingColor1(val As ULong) As String
If val Mod 2 = 0 Then
Return "WhiteSmoke"
End If
Return "White"
End Function
Public Function IncrementAlternatingColor1() As String
Dim alternatingColor As String = ComputeAlternatingColor1(m_s_AlternatingColor1Count)
m_s_AlternatingColor1Count = m_s_AlternatingColor1Count + 1UL
Return alternatingColor
End Function
Public Function GetAlternatingColor1() As String
Return ComputeAlternatingColor1(m_s_AlternatingColor1Count)
End Function
,然後在第一行的背景色:
=Code.IncrementAlternatingColor1()
和所有後續行的背景色:
=Code.GetAlternatingColor1()
這樣做的好處是您可以在一個位置切換顏色(乾燥)。
你是炸彈,但我的解析方式突出顯示第一列,但同一組的細節不是。相反,下一行細節顯示爲陰影?我如何改變它以便陰影保留在我的組中? – user3571153
Nvm。我知道了..感謝他們.. YOURE生命的節約! – user3571153