I. Description
When making a template, it is often encountered to decide whether the content of an area is displayed according to a certain condition (this content can be a data table, chart, embedded sub report, etc.). How to achieve this?
For example, in pagination preview, if you select the parameter as order information, you can see that the subreport of 'order detail' is not displayed. When you select order detail, the subreport of order information is not displayed, as shown in the following figure:
II. Implementation ideas
It can be achieved by setting the row height or column width of the conditional formatting, and judge whether to hide the cells in the range according to the condition.
III. Examples
1. Creating three reports
You can download from the template. There are two subreports and one main report. The dataset used for subreports is Orders and Ordersdetail.
2. Adding parameters
Add a report parameter named info to the template, and add a drop-down box widget in the parameter interface. The widget name of the parameter is info, the parameter value is custom and the actual value and display value are order information and order detail respectively, as shown in the following figure:
3. Conditional formatting setting
Add conditional formatting as shown in the figure below to A4 cell where order information is located:
Then add a conditional formatting with row height: 0mm to cell A7 where the order detail is located, and fill in the formula: $info ='order information' , that is, when the parameter information value is 'order information', the line will be hidden.
Save the template and preview in pagination to see the effect in I.Description.
IV. Template download
For completed templates, please refer to:
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\FeaturesApplication\HidCell.cpt
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\FeaturesApplication\Ordersinfo.cpt
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\FeaturesApplication\OrderDetails.cpt
Click to download the template:
Main report:
Sub reports: