views:

515

answers:

1

I am trying to apply conditional formatting of certain table cells in my ReportViewer control. I understand how to apply conditions by comparing data that resides in the same row, for example, the following will color a cell RED if the Cost is higher than the revenue:

=IIf(Fields!Cost.Value > Fields!Revenue.Value, "Red", "Black")

My issue is that I need to compare data to the previous row. My requirement is to flag a table cell that changed from the previous entry. For example:

TableRow 1:    Fred,   23,  Boat
TableRow 2:    Fred,   67,  Boat     ** 67 needs to be flagged

How would one go about doing this using a conditional statement?

+3  A: 

If anyone is interested in the answer, I found a solution. There is a Previous function that is built into reportviewer, that I just found.

Previous(Fields!LineTotal.Value)

It returns the previous row data. This will do what I need.

Jon
how did you get it to change color based on the condition? I'm using ReportViewer 05 for ASP.NET - I'm assuming it would be something similar to what you've written but I get an #Error when specifying colors like you did "Red", "Black"
firedrawndagger
You need to set the BackgroundColor property. What is the IIF statement you are using? There may be a logical error in it. One thing to look for, is that the color name needs to be a string, so you may need to put double quotes around them.
Jon