Conditionally Hiding Bands


In this example, we will hide the Group Header and Detail bands, if a grouping field meets a certain condition. Note that no scripts are required to accomplish this task.

Add a Group Header band to the report.
For this, right-click anywhere over the report’s surface, and in the invoked Context Menu, point to Insert Band and click GroupHeader.


Drop a field which will be used as a grouping criteria, from the Field List onto the created GroupHeader1 band.


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.


Now, select the Group Header band’s strip, and in the Property Grid, locate the Formatting Rules property, and click its ellipsis button.

In the invoked Formatting Rules Editor, click the Edit Rule Sheet… button.


Construct the required logical expression (e.g. [CategoryID] < 2), and click OK.


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