Wednesday, March 28, 2012

How to make sure background color on details group always start on the same color?

Is it possible to control start color when doing alternating background
colors on a details group in a table?
If alternating between White and Green, I want the first detail row to be
white, and the next green, regardless of row number.
I've tried using both this expression:
=iif(RowNumber(Nothing) Mod 2, "White", "WhiteSmoke")
and this:
= iif(RunningValue( Fields!MyField.Value, CountDistinct, Nothing) mod 2,
"White", "WhiteSmoke")
They both work, but they both seem to count row numbers, regardless of
grouping. If I try using the detail group name instead of nothing, I don't
get any color.
= iif(RunningValue( Fields!MyField.Value, CountDistinct, "tbl_DG") mod 2,
"White", "WhiteSmoke")
Is it possible to control this? Any advise appreciated!
Kaisa M. Lindahl LervikFigured it out, silly misunderstanding from my side.
I needed to specify the group one level higher than the details group. So
when I did
= iif(RunningValue( Fields!MyField.Value, CountDistinct, "tbl_Group1") mod
2, "White", "WhiteSmoke")
instead of
= iif(RunningValue( Fields!MyField.Value, CountDistinct, "tbl_DG") mod 2,
"White", "WhiteSmoke")
it worked very well.
Kaisa M. Lindahl Lervik
"Kaisa M. Lindahl Lervik" <kaisaml@.hotmail.com> wrote in message
news:%238BagFzUGHA.224@.TK2MSFTNGP10.phx.gbl...
> Is it possible to control start color when doing alternating background
> colors on a details group in a table?
> If alternating between White and Green, I want the first detail row to be
> white, and the next green, regardless of row number.
> I've tried using both this expression:
> =iif(RowNumber(Nothing) Mod 2, "White", "WhiteSmoke")
> and this:
> = iif(RunningValue( Fields!MyField.Value, CountDistinct, Nothing) mod 2,
> "White", "WhiteSmoke")
> They both work, but they both seem to count row numbers, regardless of
> grouping. If I try using the detail group name instead of nothing, I don't
> get any color.
> = iif(RunningValue( Fields!MyField.Value, CountDistinct, "tbl_DG") mod 2,
> "White", "WhiteSmoke")
> Is it possible to control this? Any advise appreciated!
> Kaisa M. Lindahl Lervik
>

No comments:

Post a Comment