Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Discover how to create, manage, and deliver interactive reports—not just to print, but to dynamically explore enterprise-level data—with Reporting Services in SQL Server. In this course, author Simon Allardice concentrates on using Report Builder to build and format reports from a variety of data sources, but also shows how to perform basic administration tasks such as granting user access and organizing reports in the Report Manager. Plus, learn how to add interactive sorting and filtering functionality to your reports, and create column and pie charts to better express your data.
Note: These tutorials are applicable to both the 2008 and 2012 versions of SQL Server.
Earlier in the course, I showed how we could create reports that used parameters; either typing in a value or having perhaps a dropdown selection would allow you to refresh the data based on that selection. Another way of doing this is using what's called a drillthrough report, so we could use an action to drill from one report to another. But another way of connecting reports is to use a feature called subreport, literally one report nested inside another. Now, the typical example is that we have a report like this one. I called it parameter example.
It's a report that accepts a parameter and can change what it's showing based on that parameter. But if I think this will be useful, I want to see it contained inside a larger report. So I'm going to jump over to Report Builder and do that. I've created a blank report here I've called Categories and Products, and to save some time I'll got a connection to AdventureWorksLT and a very simple dataset that is currently showing a list of categories. I'm going to show the categories on this report and then have that subreport that shows the product for each category.
I could add this to the report as a table. What I'm going to do is add it as a list because we haven't used the list yet. There's nothing magical about using a list with a subreport. It's just an opportune moment to do this. Now, when you add a list, you just then drag a free-form region onto the page. A list is simply a repeating region with whatever you put in its container repeating. Now, what does that mean? Well, if I drag over, for example, name form my dataset, I can position it anywhere I want in that list container. I'm going to zoom this up to 16-point font, just to make it a bit bolder.
If I go ahead and run this, what I get is this repeating region Handlebars, Bottom, Brackets, Breaks, and so on. But I have got a big blank area of this repeating region I can use for a subreport. I'll just drag that text box a little wider so it doesn't have a line break in any more. Up to the Insert tab, find the option for Subreport, click it once, and then draw out a space for the subreport. Now, it'll fill the space available, and it will go top to bottom as it needs to, but it's always a good idea to kind of lay it out with the amount of space that you need.
Right now it has no idea what this should be pointing to and the subreport really is just point to another report. So if I right-click on that, I should have the option for Subreport Properties, and this is where we tie the two together. Selecting that one, the main option here is which report do we want, what do I want to use as a subreport? So I'm going to click the Browse button and go out to my Report Server and find the one I'm interested in, which was Parameter_Example, and click Open. The only other important thing I need to do is select the Parameter section here to join these two together.
I'm going to add a new parameter. It will look in the report I'm pointing to and say, well, that accepts something called ProductCategoryID. That's what I want. And then in the Value section it will look at the data I currently have on this report and say, what do you want to pass? Well it's not name; it is the number, ProductCategoryID. Click OK and we're done. I go ahead and run this. Now you'll occasionally get this and testing it in preview, this data cache for the report added session is not valid. If you're works in preview, that's fine.
If not, one thing you could do is just save it. I'll call this SubreportExample. I'm saving it to my Report Server. And then I'll go and actually look at it in the Report Server as SubreportExample that I just created. So click that once and now we're actually get it viewing properly. So we have this repeating category, in this case handlebars, and then all the product for handlebars, bottom brackets, all the product for bottom brackets, and this is a subreport. And jump to the next page to see several more of them. Now, as you can see, what it's doing is adding the title of the subreport on every repeated section, which would be very different from, say, creating this table as a report part.
I probably wouldn't want to see parameter example being written out all the time. I would have to go into that subreports and edit that out. But this is the process we would use. Now, I will admit my personal bias here. I don't feel that subreports are worth the trouble most of the time. They can easily blow out a report layout. And there's very little you can do with subreports that can't be done with a normal report with multiple data regions or using report parts. But they are part of Reporting Services, and occasionally you may run into a time that's convenient to use one.
There are currently no FAQs about SQL Server Reporting Services in Depth.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.