How to prevent an empty dynamic table from printing on a report
If you have a form that contains a dynamic table that isn't always populated, you may not want the table to print on the report when the table is empty. This can be helpful when you have a simple form. Typically, you'd probably have a form with conditions and based on answers information prints on a report. However, maybe your form just has one dynamic table that techs can skip over when it's not applicable and you don't want that information to print on the report.
To prevent an empty dynamic table from printing on a report, complete the following.
- In the Form Designer, click (Reports) and select your report to open the Report Designer.
- Double-click on the sub-table (in this example, Insurance_Information) to open the Report Designer for the sub-table.
- Click on the Group HeaderBand.
- Click (Expressions) from the right-hand side of the Report Designer.
- Expand the Before Print section.
- Click the three dots in the Visible field to open the Expression Editor.
- Enter [DataSource.RowCount] > 0 And [DataSource.CurrentRowIndex] < [DataSource.RowCount] and click Apply.
- Click OK.
- Now click on the DetailSubBand.
- Click (Expressions) from the right-hand side of the Report Designer.
- Expand the Before Print section.
- Click the three dots in the Visible field to open the Expression Editor.
- Enter [DataSource.RowCount] > 0 And [DataSource.CurrentRowIndex] < [DataSource.RowCount] and click Apply.
- Click OK.
- Save the changes made to the sub-report.
- We recommend that you add the dynamic table's label to the Group Header Band. This hides the label on the report when the dynamic table is hidden too. From the toolbox on the left side of the Report Designer, click (Label) and drag a label field into the Group Header Band above the column headings of the dynamic table. Format the label accordingly.
- Save the changes made and close the sub-report.
- Back in the main report, remove the label of the dynamic table from the report.
- Save the main report and close the Report Designer.
- Click(Save) in the Form Designer to save the changes made.
- Now, if you don't populate the table, it will not print on the report when the form is submitted.
In the following illustration notice no insurance information has been entered in the Insurance Information table on the form: - The form has been submitted and the empty Insurance Information table doesn't print on the report.
FormsPro Report Designer uses DevExpress tools to create reports. For detailed information about DevExpress, see DevExpress Documentation.