This tutorial describes how to hide bands if a certain logical condition is met. Note that no scripts are required to accomplish this task.
To demonstrate this feature, we'll use a report with grouping, similar to the one created in the following tutorial: Change or Apply Data Grouping to a Report.
To conditionally hide bands in a report, do the following.
-
Select the Group Header, and click its Smart Tag. Then, in the invoked actions list, click the ellipsis button for the Formatting Rules option.
In the invoked Formatting Rules Editor, click the Edit Rule Sheet... button.
-
Now, in the invoked Formatting Rule Sheet Editor, click the button, to create a new rule. Then, set its Visible property to No, and click the ellipsis button for the Condition property.
-
Construct the required logical expression (e.g. [CategoryID] < 2), and click OK.
To quit the Formatting Rule Sheet Editor, click Close.
-
Back in the Formatting Rules Editor, move the created rule to the dialog's right section (Applied Rules), to make it active.
And, do the same for the report's Detail band. That is, click the ellipsis button for its Formatting Rules property, and in the invoked dialog, apply the same rule to this band, as well.
Switch to the Preview Tab, and view the result. In our example, you can see that the first category isn't shown. So, the conditional formatting was applied properly.