Subreport - Are Parameters Required?

Hello everyone,
Today I am creating a new report using Report Builder 3.0. The main body of the report has two elements. First a sub-report, we will get to that in a minute. The second element is a tablix showing a list of my part numbers (and a ton of other data.) My goal with the sub-report is to list all of the part numbers and the date associated. This should appear as a sort of index before the main report.

The report works great without the sub-report in place. With the sub-report in place I get the “subreport could not be shown” error in the rendered output.

I created the sub-report by saving a copy of the main report and deleting all the content from it. My theory was that I could still access the datasets by copying it this way. I setup my simple sub-report to span three columns across the page, and only show two fields (part and date). I saved this with the same name as my main report with the _sub postfix.

Back inside my main report I added the sub-report element, and entered the name that I used. Saved everything and uploaded it to test it. Both report files uploaded ok but when the report runs I still get “subreport could not be shown”.

Are parameters required to link sub-report with main report? I do not have any parameters in my BAQ, and I don’t think I need to add any. Can you think of any other reason the sub-report won’t display?

Thanks for your time and consideration!
Nate

If you want to use the same dataset as your main report, you just have to pass that @TableGUID parameter from the main. Then your query will know where to look (if you didn’t mess with it too much from the Main-> Sub anyway)

1 Like

Do I have to add a parameter in at the BAQ level, or can I just do it in the report builder?

Just the report builder. If you go to your subreport properties you will add it there.

image (Job number is an extra for my report)

1 Like

And those parameters must match the ones in your subreport:

image

1 Like

Thanks Adam! This got my sub-report working! My sub-report has three columns and my main report only has one column. It seems like the single column is overriding my sub-report’s three columns, so instead of having three columns of data across the screen I just get one column of data that stretches down across multiple pages. Have you ever used different column counts on sub-reports? Is this possible?
Thanks again!
Nate

Good deal, no problem Nate. I fumbled my way through this just the other day, and got one working after many Error: Subreport could not be showns.

Gah! I just saw this:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4ec6e9f8-2d2e-46c2-b00a-93826097ddd1/multiple-columns-in-sub-report-doesnt-show-on-the-main-report?forum=sqlreportingservices

Sounds like multiple columns in sub-reports is not supported?! I would skip the subreport and put the entire table into my main report if I could set the first table to be three columns, and the main report to be just one column.

Is there any way to add a page/section break to the main report so that I can have three columns on the top and only one column on the bottom? I realize I’m reaching here… :stuck_out_tongue:

I think I see what you mean. I racked my brain pretty hard around some columns recently…What I ended up doing was creating multiple, seperate tablix’s to represent columns (or lists/mattrices whatever you want to call them), rather than divying up the report into columns. Each tablix used the same data set, and then I added view rules (on the details) to each “column”, so it would display how I wanted. I’ll send some snaps later.

To simplify things I just pulled the sub-report out into a separate style altogether. The end user will have to now run two reports to get the data, but at least it will be formatted correctly.
Thanks again for your help!
Nate

1 Like

Good to hear! If you ever want to revisit this, here’s a good example of how you could have different numbers of columns throughout a report:

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0d6d27ad-2378-417b-8125-fa15bc4928aa/ssrs-spreading-data-across-2-columns?forum=sqlreportingservices

1 Like

He’s a trick that might work…

Make two more copies of the sub report. Each of the three subs should be sized for one column. They’ll all be identical except each will have a different row filter to show only every third record.

The left most sub will show records 1, 4, 7, 10 , etc…
The center sub will show records 2, 5, 8, 11 , etc…
The right most sub will show records 3, 6, 6, 12 , etc…

details here …

2 Likes