I have a report in which the results are grouped. For example, the report
returnd 25 rows, the first 5 rows are one group (lets say all 'A's, the
second 5 rows are another group (lets say all 'B's), etc...
Can I add conditional formatting to alternate the backgroup color based on
groups?
I know I can alternate row colors using:
=iif(RowNumber(Nothing) Mod 2, "WhiteSmoke", "White")
But I want to alternate by group. Is that possible and if so, how?
Thanks,I had a similar requirement recently but could find nothing in help or on the
net. I wrote this embedded code which works for me but I'm curious if there's
a simpler way.
Add this to the report's embedded code window:
Public GroupRowCounter As Integer = 0
Function IncrementCounter() As Integer
GroupRowCounter += 1
Return GroupRowCounter
End Function
Function GetCounter() As Integer
Return GroupRowCounter
End Function
Right click the header row you want the alternate coloring in and select
Insert Row Above. In the new, topmost header row set the Hidden property to
True and add this to one of the cells:
=Code.IncrementCounter
For the header/detail/footer portions of the group that will be visible, add
this to the BackgroundColor property to alternate the row (group) colors:
=IIF(Code.GetCounter Mod 2, "WhiteSmoke", "White")
"BillTWD" wrote:
> I have a report in which the results are grouped. For example, the report
> returnd 25 rows, the first 5 rows are one group (lets say all 'A's, the
> second 5 rows are another group (lets say all 'B's), etc...
> Can I add conditional formatting to alternate the backgroup color based on
> groups?
> I know I can alternate row colors using:
> =iif(RowNumber(Nothing) Mod 2, "WhiteSmoke", "White")
> But I want to alternate by group. Is that possible and if so, how?
> Thanks,|||If you're grouping on Country, this is the code to use.
=Iif(RunningValue(Fields!Country.Value,CountDistinct, Nothing) Mod 2,
"LightGreen", "Cornsilk")
Mike Glaser
"BillTWD" wrote:
> I have a report in which the results are grouped. For example, the report
> returnd 25 rows, the first 5 rows are one group (lets say all 'A's, the
> second 5 rows are another group (lets say all 'B's), etc...
> Can I add conditional formatting to alternate the backgroup color based on
> groups?
> I know I can alternate row colors using:
> =iif(RowNumber(Nothing) Mod 2, "WhiteSmoke", "White")
> But I want to alternate by group. Is that possible and if so, how?
> Thanks,
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment