views:

23

answers:

1

I have a report that shows client names jsut in a list like so:

ATK
FLD
FLD
DB
DB
DB
BL

I already have them grouped and everything but I am wondering if there is a way to make it so I can have each client seperated by color, for example white then grey then white then grey etc.

Right now I am using background color as the following:

=IIF(RowNumber(Nothing) Mod 2,"Gainsboro","White")

This just makes every other row white or grey. Is there a way to make every other client white or grey?

A: 

In the custom code for the report add the following:-

Public shared currentRowColour as string = "Red"

    public function GetBackGroundColour(previousValue as string, currentValue as string) as string

        if previousValue <> currentValue then
            if currentRowColour = "Red" then
                currentRowColour  ="Orange"
            else
                currentRowColour ="Red"
            end if
        end if
        return currentRowColour 

    end function

Then edit the expression for the background colour for your text box (or row) =Code.GetBackGroundColour(Previous(Fields!.Value), Fields!.Value)

SPE109