Subreport shows headers even when there are no values?

  • Hopefully this is a really stupid question. I was playing with a report with a simple subreport. (it's from a WiseOwl tutorial, so you can get the Movies database from there if you want...)

    The main report is based on Country. Just CountryID, CountryName. It's on the first row of a table with another row inside group, below. The cells are merged and inside that bottom row is a subreport, linked by CountryID. That far works fine.

    the subform is based on a query (Film, CountryID, FilmReleaseDate, RunTimeInMinutes). That works fine too. I was trying to figure out how to filter the subreport from the main report. So I did that. For grins I filtered the subreport so that

    RunTimeInMinutes<=Parameters!MaxRunTime.Value

    that works too. The odd thing is that even if a country has no films that meet the criteria, it still shows the "header". Can I hide those programmatically or something or do I have to take a giant step backwards and base my report on a query based on both Country and Film... (because the inner join will eliminate any countries with no films that meet the criteria)?

    Hope all this makes sense. If you want, I can post the report and the relevant dataset...

    Pieter

  • I haven't done exactly what you are doing but here is a possible solution.

    Change the Groups area at the bottom of the screen to 'Advanced Mode' - there is a drop-down arrow on the far right. Find the '(Static)' Row Group that applies to the headers you are interested in. Then in Properties there is a 'HideIfNoRows' - change that to True. See if that might do what you want.

    Scott

  • If you don't want to join the Film table in, you could add an exists clause to the select:

    select Countryid, CountryName

    from Country

    where exists (

    select *

    from Film

    where Film.CountryID = Country.CountryID

    and RunTimeInMinutes <= @MaxRunTime)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply