Help & Support
Contents
Display Legacy Contents

Search:

Home > Report Designer > How-To Examples > Add a sub report

Add a sub report

Home > Report Designer > How-To Examples > Add a sub report

Add a sub report


Adding a Sub Report control, you can embed existing reports into various sections of other reports. You can create side-by-side reports by placing two sub reports by each other or add multiple sub report sunder each other. These sub report would be placed on the Detail band.


The following steps show you how to add a sub report .


  1. Open the report in the designer.
  2. Click n the TOOLBOX tab on the lower left
  3. Drag the "Subreport" control into the details band.
  4. A dialog will open to select the sub report from a list of reports already designed.
  5. The Sub Report Bridge form will open. On this form you need to select the field from both reports which connect the two together. An example would be from a contact report bridged into an opportunity report would be "Contact = Contact"



  6. Using the drop downs select the bridged fields and click OK.

Tech Note: These steps will append a script into the report which is used when the sub report is printed for each row of the top level report. The code will look like this:

'----------------------------------------------------------------------------------------)
' Build the relation between the two reports
'----------------------------------------------------------------------------------------)
Private Sub subreport1_BeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
  Dim relationValue as string = me.GetCurrentRow().Row.Item("REPORTFIELD").tostring()
  CType(sender, XRSubreport).ReportSource.FilterString = "SUBREPORTFIELD = '" + relationValue + "'"
End Sub

The SUBREPORTFIELD will be the field from the "Current report field' drop down.
The REPORTFIELD  will be the field from the "Subreport field' drop down.

Advanced feature:
Double clicking on the sub report control will open the sub report in its own report designer surface.

See also



Properties
Article ID:
add_a_sub_report
Views: 183
Created By: jimdurkin
Modified By: [Modified By]
Created Date: 3/24/2014 12:31 PM
Last Modified: 3/24/2014 12:31 PM
Actions
Print This Article
Bookmark
Email This Article
Previous Article
Next Article