How to pass parameters to subreports? - sql-server-2008

I have 5 reports that all have 2 parameters: startdate and enddate.
select * from table where date between startdate and enddate
This is a simplified version of what I have, but for this problem, it should work.
I need to have all of the tables in 1 compiled report and link all of their parameters. I think I might be approaching this problem incorrectly. First of all, the server that I'm publishing the report to is SQL Server 2008, not SQL Server 2008 R2, so I don't think I can use report parts (correct me if I'm wrong). Because of this, I thought that the best way to approach this would be to use subreports. I created a new report that will contain the other reports as subreports. In the subreport properties, I set startdate equal to:
=Parameters!startdate.Value
Startdate exists in the new final report and it has a default value. I did the same thing with enddate. However, when I run it, I get the error "One or more parameters were not specified for the subreport, 'Subreport', located at :/Subreport."
I'd really appreciate any help with this, and I apologize for the length of this post. I tried to find this online, but I couldn't, so I finally made an account so that I could ask this question.
Edit: I never found the solution to this problem, but I achieved the result I wanted by just copy and pasting the tables and adding the respective datasets to the main report.

First, you have to define startDate and endDate in your main report as well as all reports that will be used as a SubReport. I don't think you are mapping the paremeters. SSRS will not auto-map same named parameters.
Add a SubReport component from the toolbox onto your main report
Right click on the SubReport and select sub-report properties
Select the Parameters list view item from the left hand list view
NOTE : If the SubReport is contained in the same vs project as your main report you should see the available SubReport parameters.
Map the name of the SubReport parameter to the value of your main report's associated parameter.

Related

SSRS - Visual Studio 2017

OK I've come across something that baffles me.
I've downloaded SSDT for Visual Studio 2017, version 15.5.2
I'm creating new .rdls. I use Reports --> Add --> New Item for Reports.
Have my DataSource and Dataset created, no problem. i use an existing stored proc to retrieve, and it's no problem.
But i cant' figure out why there is no DETAIL band. I mean, any item that is retrieved, is First(columnname) for a string column, or Sum(columnname) for a numeric column, etc. Why on earth can i not just have a detail row, for all the columns i select? Not having a detail band really defeats the purpose of a report in the first place. I can have a page header/footer for summarizations and such.
So do i need to use the Report Wizard instead? The wizard does not seem to allow me to select a stored proc, so that seems useless to me as well.
Why is there no Detail band when i create a report? i thought that was standard when creating a new report, when i used SSRS in the past.
Presuming you have placed a tablix or a matrix on the design window, Right click on the tablix.. select Tablix Properties and then set the Data set Name to your actual dataset in that window. You should now be able to select the columns as required.

SSRS - SubReport

I have a subreport I am trying to link into my main report. The main report pulls back information from one database and the subreport pulls from another. I could use lookup, but I lose the ability to format so I was hoping to achieve this with a subreport.
I enter a date range via my parameters, and let's say I get 30 client/matter codes back. It page breaks at the end of each row, so the data for each client/matter ends up on its own report. The goal is for me to output a large number of reports based on date ranges. The subreport pulls in folder names, and just like the other information, the folders for only that client/matter should be on that report.
What's currently happening is on each report, it just lists ALL of the folders for ALL of the client matters on each and every report.
I've tried making the subreport an adjacent group (which you can see in the screenshot) and grouping on Client code and then matter code. I've tried making the client code and matter codes internal parameters in both reports in the hope that it help filtered. I also tried just inserting the subreport into a cell inside the matter_code group but not as a group itself.
I apologize in advance if my explanation doesn't make sense. I'm having a hard time trying to put this into words.
From your explanation I would assume that you have a subreport in a group but you are not passing anything through to it. Have you tried passing through parameters to the subreport that uniquely define the customer and the customer folders?

SSRS 2008 R2 Subreport Displays Only on First Page

Long time browser of this site, but first time poster. Normally I'm able to find the answer I need by searching, but in this case I haven't been able to, and it's driving me nuts!
I'm using BIDS / SSRS 2008 R2 to create a membership renewal form which my business will mail out to our customers. The form contains customer information, including membership dues / subscription info and other billing details.
In order to accomplish this,
I have built three RDLs:
Main report (this is one the users run). Contains base data set
(let's call it Proc 1), which requires an expiration date only, to
pull a list of member IDs and corresponding physical information
(address, phone, membership type, etc.) Contains the first subreport,
in a list, grouped by member ID.
One subreport for the first page in the main report. Contains a
set of parameters for each field it needs. Rather than execute Proc 1
again, I pass Proc 1's output from the main report to this subreport.
Everything in this subreport is also contained within a list, grouped
by member ID parameter (passed from main report).
Another subreport, nested within the first subreport, which pulls
subscription information. First subreport passes member ID and paid
through date to detail data set in nested subreport (let's call it
Proc 2). Proc 2 requires paid through date from page one subreport,
and ONE member ID, which it gets from its parent report. It displays
this information in a table, not grouped, since it should only be
receiving one ID at a time--- being that its parent subreport. and the
main report. are already grouped. However, I have tried grouping the
table based on member ID, and it didn't make a difference.
I found this approach necessary, because of the fact that I had two write two separate stored procs: one to pull the basic data, and one to pull detailed billing data. It's impossible to combine the two without creating duplicate rows. And of course, it's not possible to have a tablix assigned to a different data set than the list it is contained within. Hence the need for a subreport. I hope that all makes sense.
Anyway, my issue is that the nested subreport only displays data for the first customer. In fact, it doesn't display the nested subreport AT ALL for the rest of the customers. It's as if the nested subreport is only being passed the first member ID, but I don't see how that's possible given the grouping? Note that I am not using any FIRST or aggregate functions in the proc or report expressions. And I can execute each report file just fine individually.
I have tried creating a dummy data set in the nested subreport (ex. SELECT 'Nothing' AS Nothing) and adding it to a text box, thinking that this would force the nested subreport to display, but it STILL doesn't. Thoughts on what I might be doing wrong? Thanks in advance.
https://social.msdn.microsoft.com/Forums/en-US/9f8b9c42-90cb-4620-ad91-9754029ed4db/seemingly-random-error-subreport-could-not-be-shown-in-a-report-with-nested-subreports-ssrs?forum=sqlreportingservices
Your nested subreport could be throwing an error that your not seeing.
Quote
The known issue in SQL Server 2008 Reporting Services described in http://support.microsoft.com/kb/967749 should be fixed in SQL Server 2008 R2. Generally, the issue occurs because the parameter value is not passed to the subreport correctly or the subreport is not valid due to the specific values passed to the subreport.
I think you should add a detail group then put the subreport in that cell. Make sure the grouping is working correctly and pass the right values to the subreport.

SSRS 2005 page break per report

I have a specific type report that I need to generate multiple copies of. What I want to do is pass a string of report IDs to SSRS and generate all of the individual reports (let call them subreports) with those IDs in one master report with each subreport on a new page. I've already tried making a subreport and placing it in a table with grouping. This worked the closest so far. It gave me all the pages I needed, but it generated the report for the first ID number over and over. Is there anyway to do this or am I gonna have to jump through a lot of hoops?
If you are passing the string of report IDs to a parameter on the master report, I think using a table and subreport should work. You'll need a way to split out the report IDs using a dataset on the master report and return them one per row (so you can pass each report ID individually to the subreport via the details row of the table).
I was going to recommend a table-valued parameter for this, but since they don't exist in SQL Server 2005 check out Arrays and Lists in SQL Server 2005 by Erland Sommarskog for a few other options.

SSRS 2005 report with multiple datasets need to change parameter

All,
I've been working on a custom timesheet report that uses multiple datasets (8 to be exact). Each dataset selects the data by the same ID field which is currently input as a parameter. It works great like that. But now I'm told that the end user wants to input a date and have all the reports printed out for that date rather than having to enter in an ID each time. Each timesheet is 2 - 3 pages. It is intended to emulate a form and contains some data but a lot of blank areas to allow the field people to write in any changes that have occurred.
My question, is this: what is the best way of accommodating the new requirement? Should I build it all as one big dataset and use the date as a parameter?
Should I create a wrapper report that would prompt for the date and then use the existing report as sub report? Would that even work?
Is there any way I can just create a new date parameter and put that ahead of the ID parameter and get them to print out like that? I've got a few hidden parameter fields on the body that get used in the page header and are used to link some of the datasets.
any help is appreciated.
Easiest way to achieve this is indeed by creating a wrapper report with the date parameter. The data set in this report will then fetch all items (with ID) that match the query by the user. The report can then have a list for that dataset, with the original report as a subreport. If you pass the ID parameter from the dataset to the subreport you wouldn't need to change hardly anything in the original report.
Two things to watch out for:
the Report Header and Footer in a subreport are not rendered - these are only rendered for the wrapper report
you may need to tweak your page breaks in the subreport and on the new list in the wrapper report so each new form starts on a fresh page