Showing posts with label alternating. Show all posts
Showing posts with label alternating. Show all posts

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

Report Formatting

Hi !
I have a simple question. I am using a Table in my report. I would like to
apply a different color to alternating rows in the table.
What is the correct or recommended way to do this?
Thank you,
YCreating a Green-Bar Report
To apply a green-bar effect (alternating colors every other row) to a table
in a report, use the following expression in the BackgroundColor property of
each text box in the detail row:
=iif(RowNumber(Nothing) Mod 2, "PaleGreen", "White")
this was from books online.
"Yoshi" wrote:
> Hi !
> I have a simple question. I am using a Table in my report. I would like to
> apply a different color to alternating rows in the table.
> What is the correct or recommended way to do this?
> Thank you,
> Y
>
>