Forum Discussion

lipster26's avatar
lipster26
Frequent Visitor
9 months ago
Solved

Paginated Report Subreport Visibility

I'm having issues with setting the visibility of a subreport using an expression. I have a subreport in a row of a table. The other rows have rectangles in them and when I set the visibility of those rows, they work fine using an expression. They will show/hide as expected with no blank pages. When I use an expression on the row where the subreport is, the subreport does not generate but it renders a blank page. I've tried setting the expression at the subreport level and the row level. Both same results in blank page when the expression is true. If I set the row to Hide with no expression, then no blank page renders. What can be done to hide the subreport row without a blank page?

5 Replies

  • Hello,

    Here are a few suggestions:

    • Use an expression on the table row (Row Visibility)
      This is what you are already doing, but you need to ensure that the expression returns True only when no data is to be displayed.
      • Example: =IIF(Fields!HasData.Value = False, True, False)
        However, this is not always sufficient if the subreport is still being evaluated.

    • Using an expression in the subreport itself
      In the subreport, you can add a visibility condition to the main object (e.g. a table or data region) so that it does not generate anything if the data is empty.
      This prevents the subreport from generating empty content that takes up space.

    • Using an expression in the NoRows property of the subreport
      You can define an empty message or a specific action when the subreport has no data
      =IIF(CountRows("DataSetName") = 0, "", "empty sub-report")

    • Reduce the height of the line
      If you cannot avoid generating the line, you can try reducing its height to a minimum (e.g. 0.1 cm) when it is hidden, to prevent it from causing a new page.

    • Use a rectangle around the subreport
      Place the subreport in a rectangle, then apply the visibility expression to the rectangle rather than to the subreport or line. This can sometimes manage space better.

    • Check page breaks
      Ensure that:

      • There are no page breaks defined on the row or table.

      • The sub-report does not have any before/after page breaks in its properties.

    Please feel free to give a kudo and mark this as the answer if it helped you.

    Have a nice day,

    Vivien