Basic Sub Report Help

  • Here's my logic:

    Main report

    A simple query to return a list of firms based in a specific country, the user selects the country.

    Sub report

    A simple query to return the contact names for contacts located in the universe of firms above.

    In practice the main report will be more complicated, allowing the user to specify quite a number of parameter values.

    It's my understanding and thinking that since the contact table contains the Firm ID that's all I'd need to link the main and sub report? - i.e. the main report has done all the hard work then the Sub Report just has to fetch contacts meeting the universe of Firm IDs in the main report.

    So, is this a correct understanding of main and sub report linkage?

    I've created a simple contact report - just pulling off the first and last name and said where firm_id = @Firm_ID

    When I add this report as a sub report into my main firm level report I then go to the parameters of the subreport. There's nothing in the dropdown box for me to choose! - The value field has things I'd expect - =First(Fields!firm_id.Value, "DataSet1") for example, but the name box is blank and there's nothing in the dropdown.

    Typing in the parameter and trying the report it throws an error on the subreport... An attempt was made to set a report parameter 'Firm_ID' that is not defined in this report.

    Not really sure where I'm going wrong, any ideas anyone?

  • It sounds like the Firm_ID isn't really a parameter in this instance. You're passing in a country to the main report, but the subreport depends on data from that dataset (firms from the specified country). Have you tried adding the country to the subreport in a join, such that both the main and subreports use the country parameter?

  • I've not tried that no, because whilst it would be a trivial exercise in this example it's real world usage would be on a report which has quite a few parameters specified so joining to all those tables and adding all those variables each time is not ideal... Perhaps my logic's incorrect then, I thought I could just build whatever complicated universe of IDs from the main report and just pass these to the subreport and evaluate it against this universe.

    Atm I'm having bigger problems - even standard reports aren't working - it seems either my PC or VS2008 is knackered :/ - VS keeps crashing on preview with the following:

    Problem signature:

    Problem Event Name: CLR20r3

    Problem Signature 01: devenv.exe

    Problem Signature 02: 9.0.30729.1

    Problem Signature 03: 488f2b50

    Problem Signature 04: System.Drawing

    Problem Signature 05: 2.0.0.0

    Problem Signature 06: 49cc5f38

    Problem Signature 07: 24b

    Problem Signature 08: 121

    Problem Signature 09: System.ComponentModel.Win32

    OS Version: 6.0.6002.2.2.0.256.6

    Locale ID: 2057

  • Not sure how well this would work (if at all), but here's an idea. If you had cascading parameters, you could link the FirmID's to the country, hide the FirmID drop-down, and select all FirmIDs in the drop-down by default. That would bridge the gap between the country and its firms without having to add a join between the two in the related queries. I've never tried something quite like that, so it's just a theory.

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

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