Hide space between elements of a report

2019-08-19 18:43发布

问题:

I have one report with various subreports. These subreports are within a table cell. When the subreport doesn't have any data available, I hide the components (tables, textbox, charts) in that subreport. However, this creates some blank space and I need to eliminate this space.

I already used the properties ConsumeContainerWhiteSpace and KeepTogether, but the blank space is still there.

Any suggestions to remove the blank space?

回答1:

To hide or show an entire row based on another reports results will be difficult, if not impossible. You will need to get this data in your parent report somehow.

I would create a cut down version of your subreport's query that returns row count for every subreport, but within the parent report. Might look like this:

UserID   RecordCount
  Abby       3
  Bob        0
  Carl       1

If you are using SSRS 2008r2 you can then use a lookup function to set row visibility. For example the row visibility expression might be

=IIF(Lookup(Fields!UserID.Value,
       Fields!UserID.Value,
       Fields!RecordCount.Value,
       "LookupDatasetName") > 0,
    false,
    true)

If an earlier version of SSRS, then join that dataset into the dataset for your table.