I am using RDLC reports in asp.net.
I am getting numerical data e.g.
7000,
6000,
8000,
9000
in a particular column i.e. BidPrice
and it's expression `=CDec(Fields!BidPrice.Value)
`Now upon loading RDLC report it should show the lowest value being highlighted in RED color i.e. 6000 should be highlighted in red or any other lowest value after it.
I can't find any color function etc so please help.
Update: I did this but it shows the largest number in Red.
Best Answer
Almost each property of your report items can be an expression. In your case you need to use an expression for placeholder properties of table cell.
Walk-through is for Report Builder but same code applies to every designer you use.
· Double click table placeholder to open its properties.
· Select Font section.
· Click on fx button near Color combo box.
· Replace existing constant expression with
Don't forget to replace
Dataset1
with your dataset's name.· Close all dialogs confirming with OK.
You have the same property available also in the property grid (where you may also change background color, for example to have white text on red background).
Example:
Explanation:
Iif
returns its second argument if expression of first argument evaluates to true and third argument otherwise. We use it to select one color according to an expression.Now we have to find minimum value, we can use an aggregate function over entire dataset (
Fields!BidPrice.Value
always evaluates for current record thenMin(Fields!BidPrice.Value) = Fields!BidPrice.Value
is alwaystrue
). Syntax is straightforward:Min(Fields!BidPrice.Value, "DataSet1")
finds minimum in whole set of data.Expression returns
"Red"
constant for values that equal to minimum (even multiple ones) and"Black"
for the others. More complex expressions may be combined (for example to alaso highlight in green maximum value).