The requested page is not available for the requested platform. You are viewing the content for Default platform.

Apply Conditional Formatting

This tutorial describes how to change a report element's appearance based on a logical condition, for example, make a label's text bold if its value exceeds a specific threshold.

report-server-conditional-formatting-result

Do the following to accomplish this task:

  1. Switch to the Report Explorer, select the Styles node and click the plus button to add a new style as in the previous tutorial.

    report-server-add-new-style

  2. Select the created style, go to the Properties panel and specify the appearance (for instance, make the font bold).

    report-server-style-appearance-settings

  3. Select the table cell bound to the Discount data field, open the Expressions tab and click the StyleName property's ellipsis button.

    report-server-expressions-tab-style-name

  4. In the invoked Expression Editor, specify the logical condition for switching to the created style. For instance, use the following expression to apply this style if the Discount field value is greater than 0:

    iif( [Discount] > 0, 'xrControlStyle3', ?)

    report-server-expression-for-style-name

  5. You can also apply conditional formatting to individual appearance settings in the Expressions tab (the foreground and background colors, font options, etc.). The Expression Editor provides the Values section containing relevant values that can help you to construct a valid expression for specific properties.

    report-server-expression-for-fore-color

Click the Preview report-server-web-preview-button toolbar button to see the resulting document.

report-server-conditional-formatting-result

See Also