Answered by:
Alternate row colour in a matrix in ssrs .

Question
-
Hi,
I am creating a matrix in which row color changes alternately(1st row white second row blue and so on .) now i am calling this matrix as a sub report in other report and i had applied grouping on that row in which this MATRIX is called .
the problem i am facing is in first sub report 1st row is coming in white color while in second sub report 1st row is coming as blue color background And so on...
why so is happening as i want 1st row as white and second row as blue i all sub reports .
if anyone has any solution then please suggest .
Thanks
Ravi
Tyagi Ravi
Tuesday, July 7, 2015 10:51 AM
Answers
-
Hi Ravi,
According to your description, you have created a matrix in a subreport, and specify alternative row color. When you call this subreprot in a main report, the alternate row color doesn’t work, right?
In your scenario, please refer to steps below to alternate row color in subreport:
1.Add the custom code below to the subreport:
dim Counter as integer=0 Public function getCounter() as Integer Counter=Counter+1 return Counter end function
2.Add a column to the right of the matrix, type the expression below to inserted column:
=code.getCounter3.Change the text-box name to "rownumber" and set the visibility of inserted column to "Hidden".
4.Use the expression below to set the background color:
=IIF(ReportItems!rownumber.Value mod 2 = 0,"White","Blue")If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support- Edited by Qiuyun YuMicrosoft contingent staff Wednesday, July 8, 2015 9:57 AM
- Proposed as answer by Qiuyun YuMicrosoft contingent staff Friday, July 10, 2015 9:02 AM
- Marked as answer by Tyagi Ravi Wednesday, July 15, 2015 7:27 AM
Wednesday, July 8, 2015 9:52 AM
All replies
-
-
Hi ,
i AM USING VB CODE TO ACHIEVE THIS BUT ITS NOT WORKING FINE .
Public RowStatus as Boolean = False
Public Function GetRowStatus as Boolean
RowStatus = Not RowStatus
Return RowStatusEnd Function
2:DECLARING A VARIABLE AT GROUP LEVEL .
3 AND PUTTING THIS EXPRESSION ON GROUP BACKGROUNDCLOR
=IIF(variables!RowColor3.Value,"white" ,"#ccdaf0")
Tyagi Ravi
Wednesday, July 8, 2015 5:14 AM -
Why not use something like below
=IIF(RowNumber("RowGroupName")%2 > 0 ,"white" ,"#ccdaf0")
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook PageWednesday, July 8, 2015 5:28 AM -
Hi Ravi,
According to your description, you have created a matrix in a subreport, and specify alternative row color. When you call this subreprot in a main report, the alternate row color doesn’t work, right?
In your scenario, please refer to steps below to alternate row color in subreport:
1.Add the custom code below to the subreport:
dim Counter as integer=0 Public function getCounter() as Integer Counter=Counter+1 return Counter end function
2.Add a column to the right of the matrix, type the expression below to inserted column:
=code.getCounter3.Change the text-box name to "rownumber" and set the visibility of inserted column to "Hidden".
4.Use the expression below to set the background color:
=IIF(ReportItems!rownumber.Value mod 2 = 0,"White","Blue")If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support- Edited by Qiuyun YuMicrosoft contingent staff Wednesday, July 8, 2015 9:57 AM
- Proposed as answer by Qiuyun YuMicrosoft contingent staff Friday, July 10, 2015 9:02 AM
- Marked as answer by Tyagi Ravi Wednesday, July 15, 2015 7:27 AM
Wednesday, July 8, 2015 9:52 AM -
This method works like a charm for my application in a Matrix Report. Thank you for taking the time to share it!Tuesday, May 22, 2018 2:23 PM
-
https://www.sqlshack.com/alternate-row-colors-in-ssrs/
Thanks Shiven:) If Answer is Helpful, Please Vote
Wednesday, March 4, 2020 10:20 PM