Sdílet prostřednictvím


Adding Conditional Formatting

You can design a report so that different styles are applied to items based on the data in the report. For example, you can display negative numbers in red or change the background colors on a table.

To make styles conditional, use an expression instead of a static value for the style properties of the item. For example, to make a text box render negative values in red for a field called Profit, open the Properties Window and use the following expression in the Color property:

=iif(Fields!Profit.Value < 0, "Red", "Black")

Creating a Green-Bar Report

To alternate the background color for every other row in a tabular report, use the following expression in the BackgroundColor property of each text box in the detail row:

=iif(RowNumber(Nothing) Mod 2, "PaleGreen", "White")

You can build expressions based on a number of functions. For more information, see Using Expressions in Reporting Services.

See Also

Concepts

Designing the Report Layout
Applying Style Properties to Report Items
Formatting Numeric and Date Values in a Report
Using Parameters in Expressions

Other Resources

Working with Parameters in Reporting Services
Tutorial: Adding Parameters to a Basic Tabular Report
Tutorial: Advanced Features Using Parameters

Help and Information

Getting SQL Server 2005 Assistance