Tuesday, February 21, 2012

Report formatting - green-bar effect

I'm trying to apply the green-bar effect to the detail rows in my report but
the alternating colours are not being applied correctly. The report uses a
table with 3 nested groups defined. For discussion purposes I'll call them
Group A, B and C. Group A is the outermost group, Group B is nested within
Group A, and Group C is nested within Group B. My result set is correctly
displayed so that I end up with 12 rows in Group C. However if I check the
number of rows using the RowNumber function, it tells me there are 20 rows
being returned for Group C.
I looked at the result set in SQL Query Analyzer and discovered that there
are 20 rows, but of these only 12 are unique. So I see why the alternating
colours aren't working, but am not sure how to fix it. Any ideas?
Thanks
--
DawnDawn,
The solution below assumes that you don't have much traffic, concurrent
sessions will cause problems.
Regards,
Cem
Shared ColorState as Boolean = True
Shared Function AlternateColor() as Boolean
if ColorState then
ColorState = False
Return False
else
ColorState = True
Return True
end if
End Function
In the report use IIF(Code.AlternateColor(),"Red","Green")
"Dawn" <Dawn@.discussions.microsoft.com> wrote in message
news:CBF95E44-4B54-4B8A-AFB4-3EEAC0D5B3B5@.microsoft.com...
> I'm trying to apply the green-bar effect to the detail rows in my report
> but
> the alternating colours are not being applied correctly. The report uses a
> table with 3 nested groups defined. For discussion purposes I'll call them
> Group A, B and C. Group A is the outermost group, Group B is nested within
> Group A, and Group C is nested within Group B. My result set is correctly
> displayed so that I end up with 12 rows in Group C. However if I check the
> number of rows using the RowNumber function, it tells me there are 20 rows
> being returned for Group C.
> I looked at the result set in SQL Query Analyzer and discovered that there
> are 20 rows, but of these only 12 are unique. So I see why the alternating
> colours aren't working, but am not sure how to fix it. Any ideas?
> Thanks
> --
> Dawn|||Dawn,
Also take a look at this example, it helped me immensely when trying to
accomplish the same thing- it's how to create a Green Bar Matrix
http://blogs.msdn.com/chrishays/archive/2004/08/30/223068.aspx
Bill Youngman
Anexinet, Inc.
"Dawn" <Dawn@.discussions.microsoft.com> wrote in message
news:CBF95E44-4B54-4B8A-AFB4-3EEAC0D5B3B5@.microsoft.com...
> I'm trying to apply the green-bar effect to the detail rows in my report
but
> the alternating colours are not being applied correctly. The report uses a
> table with 3 nested groups defined. For discussion purposes I'll call them
> Group A, B and C. Group A is the outermost group, Group B is nested within
> Group A, and Group C is nested within Group B. My result set is correctly
> displayed so that I end up with 12 rows in Group C. However if I check the
> number of rows using the RowNumber function, it tells me there are 20 rows
> being returned for Group C.
> I looked at the result set in SQL Query Analyzer and discovered that there
> are 20 rows, but of these only 12 are unique. So I see why the alternating
> colours aren't working, but am not sure how to fix it. Any ideas?
> Thanks
> --
> Dawn

No comments:

Post a Comment