Search code examples
c#vb.netreporting-servicescrystal-reportsreport-designer

Adding Details to a MS Report Viewer report without resorting to Subreports/drill down


I've worked with Crystal Rpt and the VB6 Report Designer before and I'm now moving on to Microsoft Report Viewer.

I'm actually trying to achieve something quite simple but I can't seem to find how to do it in a simple manner:

I have an orders list where each line is composed of Order Id, Customer Name and Address. I am able to list them in Report Viewer.

Next, I want to be able to show a list of items below each order in something line this:

+ORDER 1, Customer A, Cust Address
|-- Product 1 for Order 1
|-- Product 2 for order 1
+ORDER 2, Customer B, Cust Address
|-- Product 1 for Order 2
....

I know I can link this information through subreports but this seems way of an overkill for such a simple scenario.

In the (very) old VB6 Report designer, it was possible to add sub sections to the report and link the Main section with the sub section through a parameter, without having to go through the whole Subreport feature, keeping everything in one single report.

Is there such a way to achieve this in Report Designer/Viewer (i.e. adding sub sections, avoiding the use of Sub reports)?

Thank you Pedro


Solution

  • You should be able to do this all on 1 report if you use Groups and a sub-tablix.

    1. Create the table with a header row and detail row, and change the default Row Group called "Details" to Orders, and have it Group on your Order Number:

    SSRS Group Properties window

    1. Insert another row "Inside Group - Below" under the Order Num, and merge all of the cells across.

    2. Insert a rectangle into the merged cell, and then insert a Table on top of the rectangle. Add your product fields there. (In image below, everything in the Parent table is grey, and the sub-table is white)

    Sub-table inside of a parent table cell

    When you run this, since the Product row is inside of the same grouping as the Order row, each time that row is displayed, it will only show the Products that are associated with that Order (assuming your query has them linked correctly).

    Hope this helps! Let me know!