Tuesday 31 July 2012

SSRS Report: Create Sub Report From another SSRS project or solution

Scenario
For example: Main Report has been deployed in server_name/Student Lists folder and Sub Report has been deployed in the server_name/Student Lists/Sub Report Folder from another solution.


Solution:
  1. Create or open the main report
    • Insert-->Subreport
    • Select Subreport-->Right click-->Subreport properties:
      • General Tab: in the Use this report as sub report option--> set ../Student Lists/Sub Reports/Tutor List Sub
      • Parameters Tab: Use these parameters to run the subreport option. Click Add to insert a parameter. In the Name field type the name of the parameter and in the value field type the value as this [@parameter_name] format
  2. At this stage report will work fine in the Report Server but not in the Business Intelligence Development Studio
  3. Deploy the main report and subreport 
  4. Now go to the Report Server manager using a browser --> http://reportserver/reports/ 
    • Select the sub report folder and click manage 
    • From the properties --> Click Hide in the Tile view or Hide in the list view checkbox

*********Extra Note*********

To add a subreport

  1. In Design view, click Subreport in the Toolbox.
  2. On the design surface, click a location on the report and then drag a box to the desired size of the subreport. Alternatively, double-click the design surface to create a subreport of fixed size.
    NoteNote
    If the subreport is in the project, you can drag the report from Solution Explorer onto the design surface to create a subreport.
  3. Right-click the subreport, and then click Subreport Properties.
  4. In the Subreport Properties dialog box, type a name in the Name text box or accept the default.
  5. In the Use this report as a subreport list box, type the name of the report. The name of the report can be specified in the following ways:
    • For a report in this project, select the name of the report from the drop-down list.
    • For a report published to a report server configured for native mode, use a full or relative path to the report, without the file name extension. If the report is in the same folder as the current report, use the name of the report only. If the report is in a different folder, use a relative path to the report (for example, ../Reports/DetailReport).
    • For a report published to a report server configured in SharePoint integrated mode, use the name of the report including the file name extension (for example, DetailReport.rdl). The subreport must be in the same folder as the main report. Relative paths are not supported.
  6. Click OK.

To specify parameters to pass to a subreport

  1. In Design view, right-click the subreport and then click Subreport Properties.
  2. In the Subreport Properties dialog box, click Parameters.
  3. Click Add. A new row is added to the parameter grid.
  4. In the Name text box, type the name of a parameter in the subreport. This name must match a report parameter in the subreport. If the subreport is in the project, you can choose the parameter from the drop-down list. If the subreport is on the report server, run the report in Report Manager, and on the Properties tab, click Parameters.
    NoteNote
    The parameter name must match the name of a report parameter, not a query parameter.
  5. In the Value list box, type or select a value to pass to the subreport. This value can be static text or an expression pointing to a field or other object in the main report.
  6. Repeat steps 3-4 to specify a value for each subreport parameter.
    NoteNote
    All parameters that are required by the subreport must be included in the Parameters list. If a required parameter is missing, the subreport is not displayed correctly in the main report.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home