1
votes

I am generating a spreadsheet using the same data source that a report created in SQL Server Report Builder uses. I downloaded the report's *.rdl file, and am using the three datasets it generates, two from simple queries, and one from a complex Stored Procedure.

Both the *.rdl file and the project in MS SQL Server Report Builder show me that there are only these two queries and the Stored Proc plainly affiliated with this report.

I am successfully getting all this data - the two queries supply values that I use to populate comboboxes, and the Stored Proc returns several fields which I use in the report's "Summary" section.

However, the legacy report, which I can generate either from SSRS (web page) or directly from Report Builder ALSO print a "Detail" section below the "Summary" section.

I don't know where this data is coming from - the *.rdl file contains only this reference to a "subreport" as a clue:

   <Subreport Name="subreport1">
        <Parameters>
          <Parameter Name="BegDate">
            <Value>=Parameters!BegDate.Value</Value>
          </Parameter>
          <Parameter Name="EndDate">
            <Value>=Parameters!EndDate.Value</Value>
          </Parameter>
          <Parameter Name="Member">
            <Value>=Parameters!Member.Value</Value>
          </Parameter>
          <Parameter Name="Unit">
            <Value>=Parameters!Unit.Value</Value>
          </Parameter>
          <Parameter Name="Type">
            <Value>=Fields!T.Value</Value>
          </Parameter>
        </Parameters>
        . . .

I don't supply a "Type" parameter - I get the "Summary" data using the other four parameters. And the values displayed in the subreport do not appear in the *.rdl file. Where could these be coming from?

I look for the returned values from the Stored Proc this way:

string[] columnNames = dtPriceComplianceResults.Columns.Cast<DataColumn>()
    .Select(x => x.ColumnName)
    .ToArray();
if (columnNames.Length > 5)
{
    MessageBox.Show("more than 5");
    // TODO: If there are more fields, use these to generate the "Details" section of the report
}

...but it never has more than the few fields which are used to populate the "Summary" section of the report/spreadsheet.

Is it possible that if I supply a value to the "Type" parameter, I might get more data? Even if so, it's highly vexing/perplexing to me that there seems to be no reference to this subreport's data source within the *.rdl file.

UPDATE

Is it possible that the "Type" parameter is supplied for the user right in the *.rdl file? (I'm home now, and don't have access to it to look, but I wonder if that's a common pattern for *.rdl files, or at least something that's possible).

If so, maybe the Type parameter provides returns those additional fields.

1
The <Subreport> should have a child element called: <ReportName> that contains a path to the subreport (within the SSRS pseudo-folders). Something like: <ReportName>/Dev/TestSubReport</ReportName> Do you see that element in the RDL you downloaded? - David Tansey
Thanks; I'll check it tomorrow, when I'm back at the grindstone. - B. Clay Shannon
As David says, the detail subreport is actually another report linked into this report and all the datasets it uses are in that report, not the main one. The Type parameter is a parameter of the subreport, not the main report, and gets supplied the value from the current report's T field when the subreport is run. - Chris Latta

1 Answers

1
votes

The <Subreport> element in rdl has a required child element of <ReportName>.

If you look at the value of that element it should have a path to the subreport (in terms of the pseudo-folders on the SSRS server). You should be able to go to that path on the SSRS server and download the RDL file for the subreport the same way you did for the primary report.

I created a few test reports and subreports to check this. Then I did some digging to find docs online -- it is not so secretive but it was not so easy-to-find either.

The schema for the RDL file XML clearly shows that <ReportName> is a required element for <Subreport>.

RDL File XML schema