Conditionally change the appearance of a control
This procedure describes the steps to conditionally change a control's appearance.
- Create a new report.
-
Drag the required fields from the Field List onto the
report's Detail band.
For more information, see Report bands.
-
Select the report by clicking anywhere over the blank area around its bands,
and in the Property Grid click the browse button
(...) for the Formatting Rules
Sheet property.
This opens the Formatting Rule Sheet Editor dialog box, which you can use to manage and customize formatting rules for the report's bands and controls.
-
In the Formatting Rule Sheet Editor, click the
Add button to create a new formatting rule, and click
the browse button (...) for the
Condition property.
-
In the Condition Editor, define the required Boolean
condition.
In the figure, fields are formatted if the UnitPrice value is greater than 30.
- Click OK to save the condition and close the Condition Editor dialog box.
-
Back in the Formatting Rule Sheet Editor, define the
formatting to be applied.
- Select the band or control to which to apply the formatting rule (for example, the Detail band), and in the Property Grid, click the browse button (...) for the Formatting Rules property.
-
In the Formatting Rules Editor, select the rule and
click the > button to move the formatting rule from
the Available Rules box to the Applied
Rules box.
The rules are applied in the same order that they appear in the list. The last rule in the list has the highest priority. You can move a rule up and down the list with the up and down arrow buttons.
The result is shown in the figure.