I have an SSRS report that contains 20 sub reports in it. Each sub-report represents a phase in a specific cycle. All sub-reports are identical in formatting and such, containing specific data to that phase and displaying a start and end date. I was wondering if there is a way in Report Builder to essentially have those sub-reports be dynamic and sort themselves based on their specific start dates instead of just displaying them the one I have them listed in my report?
This is quite simple.
You already have you main report and sub reports so that's good. I assume your subreport takes a parameter which indicates the phase.
Assuming this, let's say the parameter your sub-report accepts is called pPhase
In your main report, remove all the existing sub reports
Next, create a dataset, lets call it dsLoop
Set dsLoops dataset query to return the phases in order for example SELECT DISTINCT PhaseNumber from myTable ORDER BY PhaseNumber
Now add a table control, remove the header row and two of the columns leaving just a single cell.
Make this cell as wide as you need, wide enough for your subreport, height does not matter.
Set the DataSetName property of the table to dsLoop
In the remaining cell, right-click and choose Insert --> Subreport. A subreport control will fill the cell.
Right-Click the subreport control and choose Subreport Properties, choose your subreport from the list
Still in the subreport properties, click the parameters tab, add a new parameter.
Set the Name to the parameter name that your subreport accepts (pPhase in our
example) . Finally, set the Value to the name of the field that contains
your parameter data (PhaseNumber in our example)
That's it...
Now when you main report runs, a row will be created in your table for each entry in dsLoop, each row will contain your subreport and each will have the parameter passed to it that is specific to each row.
If you have any issues, let me know and I'll post a full example.
Related
My quality engineers have asked me to create a report based on a document that they fill out manually. At first glance, it appeared to be an easy enough request. It has been anything but easy. This report shows the results of two inspections and I have a parameter where the user selects one inspection or the other. As it stands now, this report runs just fine when selecting one inspection, but I am anticipating a request to be able to run the reports for both inspections at the same time. And, that's where I run into trouble.
The problem is that I have a text box in the header that is referencing a value from a table in the report that identifies the inspection. When I set the parameter to a multi-value parameter and select all, the report only displays one of the inspections across the entire report. Is it possible to have the user select both inspections but have the report run them separately? I have one dataset for the table and a column in that table that identifies the inspection. I have tried the multi-value parameter and I have tried using the filter option in the dataset properties, but I get the same result.
The easiest way to do this might be to create a new master report and use your current report as a sub-report. It's fairly simple.
Here's the basic steps...
Make a copy of your current report and rename it (say sub_InspectionReport)
Change this report so the the inspection parameter is NOT multi-valued
Create a new report and add your parameter(s) the same as you setup for your original report, This time make sure your Inspection parameter (e.g. pInspection) IS multi-valued.
Create a dataset (dsInspectionIDs) that returns a list of the selected inspection values from the pInspection parameter. The query could be something simple like
SELECT InspectionID FROM myInspectionTable WHERE InpectionID IN (#pInspection)
Note: #pInspection is the name of your report parameter, it is case sensitive.
Now add a table to the report and, as a simple, test, se the dataset of the table to your daatset dsInspectionIDs. Set the first column to show the only available field (in this example InspectionID).
Run the report and test the output using different inspection parameter selections. The table should match what you have selected...
We're almost there...
Now in one of the table cells (but not in the header) , right-click and select "Insert / Subreport". Now right-click the sub-report placeholder and set the sub report to be the copy of the original report we made at the start (sub_InspectionReport in this example). Now, still in the sub-report properties, go to the parameters tab and set the Inspection parameter to the the InspectionID field.
Now when you run the report, you will get your sub-report run once for each selected parameter value with that parameter passed to the sub-report.
Hope that makes sense, I'm not near my PC so I can't provide a sample with images at the moment.
I have the following format in my dataset (see Dataset Layout screenshot).
I need this report to show like the following (see Report Layout screenshot) with a bit of a difference, but first let me explain.
This report is a "monthly" report that shows the data for each day of a given month. What I have shown in the Report Layout screen shot is how the report displays if the user only selects one available value for column "Level!2!Sample". So in other words, instead of seeing multiple values in that column as shown in the screen print, it would only contain one distinct value. This report works when only one item is available, but I need to allow for multiple options.
What I need to do is be able to display data like this for multiple values of "Level!2!Sample", and each time a new "Level!2!Sample" is encountered, it would create a new matrix as shown in the screen print. So if there are four distinct items for this column, I would have four different tables shown on the report, each displaying the data for the given distinct value of the "Level!2!Sample" column.
I assume I would need to use an "Order By" clause to get my data looking correctly:
Order By
Level!2!Sample,
name!3!Title,
month!4!ReportMonth
But I am not sure how to get SSRS to create a new matrix when the new level!2!sample record is encountered.
I hope my explanation makes sense as to what I am trying to do. Any help is greatly appreciated.
You can't create a new matrix like that but there are other options.
Simple option: Create one big matrix grouped by Level!2!Sample and have page break between groups. This would obviously mean you would end up with 4 pages in your sample scenario which may not be ideal.
Slightly less simple option:
Create a new report
Include your parameter as you did for the current report.
Add a dataset (let's call it dsLoop) that returns a single column and 1 record per selected parameter entry. This might look something like SELECT DISTINCT Level!2!Sample FROM myTable WHERE Level!2!Sample IN(#myParameter).
Add a table with a single column and a single row and set it's width to the width of your report/page.
Set the dataset for the table to be dsLoop
In the table's cell insert a subreport and set the subreport properties to point to your original report
Set the subreport parameter to Level!2!Sample from your dataset.
Notes:
a. You can get rid of the available values and related datasets from your original report as these are no longer needed (optional)
b. You can add rows before or after the cell with the subreport if you want to add gaps between each tablix.
Basically your new report acts as a loop and creates one row per selected item in the parameter list, each row contains an entire subreport with the parameter for the current row passed to it.
The net result is that you will get a 'new' table for each selected entry.
Hope that makes sense.
I have a report that has one table with two rows. The first row is just a header, the second is a subreport. The subreport consists of a single table. I want to pass one parameter into the subreport (Fields!patient_id.Value) and have the subreport repeat for every patient id. I have that working, but for some reason it inserts a pagebreak after every instance of the subreport when I look at the print preview, even though it could easily fit four of them on one page. I haven't set anything to insert a pagebreak at any place in the report or the subreport. I do want the page to break, but only when there is not enough room on the page to fit an entire subreport.
I've done enough troubleshooting to be able to say for certain that it is the subreport control or the subreport itself that is causing the problem, not the table. Any help would be appreciated.
Edit: It's also important to note that when I preview my subreport, there are no page breaks.
I found a solution. Instead of putting the subreport into the table, I put it into a list with a grouping expression of "=Fields!patient_id.Value".
set the ConsumeContainerWhitespace = True on the Report Properties
default is set to false and it attempts to preserve the blank space next to your table
I have a master report that has no parameters. But I have to include a sub-report with the same grouping as the master report. (i.e, the same report has to show data for the same project listed in the master report) I'm using different Datasets for both reports but the tables come from the same database. I've tried including a parameter into the subreport and pass the current projectID into the parameter of the subreport. It doesn't seem to be possible.
Is it possible to pass field values in master report as parameters in subreports?
I'm a bit curious on your "it doesn't seem to be possible" because I'm currently working on master report and subreport as well. The answer for your short question is "YES". it is absolutely possible to pass value from master report to subreport.
So Can you please check them again whether their properties are correct or not?
For example.
Your subreport's parameters are created properly?
You can try put your subreport inside detail row of your master report.
When you set properties of subreport, you can set which field of master report you want to be a parameter for subreport. it's quite straightforward.
Hope this help.
PS. sorry for my poor english.
Absolutely yes.
Put a dataset in your main report that will go through your projects as you want it. Then put a LIST, that's the key point. The list should refer to this dataset.
Now put your dataset inside the list's container area and set it's parameter to the project ID of your main report's dataset.
Easy.
This is just clarification of what the previous people said:
NOTE: In this example T9_PK is the primary key for Table 9 (i.e. the employee table)
The purpose here is to create a subreport that is the 'Time Card' for each employee, and then create a Main report that has all the employee Time Cards, each on a new page.
Create a report that uses a parameter (e.g. Parm: T9_PK) {This will be the Sub-report e.g. TimeCard.rdl}
Drag drop 'List' control onto design surface of a new report {This will be the Main Report}
Add a dataset to the Main Report that has a field that will end up being the Parameter of the 'Sub-report.
Drag the field (e.g. T9_PK) from a dataset {previously added to report}into the List 'Control.
Drag drop a Subreport control into the Cell of the List Control, on the Main Report (e.g. AllTimeCards.rdl).
Set the subreport to the previously created report (e.g. TimeCard.rdl, with a single Parm: T9_FK)
Set the Subreport properties => Parameters:
Name: T9_PK
Value: [T9_PK]
NOTE: the Parameter for this sub-report is the one that is coming from the dataset for the Main report
Right click on '(Details)' in the 'Row Groups' Pane (below Design Surface) => New Group => T9_PK
As an additional option set the page breaks:
Right click on '(T9_PK)' in the 'Row Groups' Pane (below Design Surface) => Group Properties {window}
=> Page Breaks {left pane} =>
Page Break Options:
[x] Between each instance of a group
I have a report table with all the combinations of dimensions as generated by the parameters set by the user. Each row contains 1 combination and a link to another report with charts. How do I pass that combination of parameters/dimensions to that other report?
In the row, I have a textbox Action which has a "Go to report" hyperlink. In the main report. I see an option "Use these parameters to run the report" which I fill out with the similarly named parameters on both reports.
On the linked report, the user should not have to pick options from that set of parameters again. Setting the report parameters to internal, hidden with blank prompt (a single space), visible with blank prompt (a single space), and putting a (Null) default value still gives: "The report parameter is read-only and cannot be modified. (rsReadOnlyReportParameter)"
What gives? How should the parameters be configured on either side so the combination of parameters are passed to the linked report?
If it is truly a linked report, then you should be able to hide the parameter in the linked report properties.
If it's a drill through report (more likely), then just set the parameter to hidden in designer. Internal means it is not exposed at all:
Setting the Hidden and Internal
options provides different levels of
visibility. You can hide the parameter
on the parameter input area of the
published report, yet set values for
it on a report URL [My text: this is what drill through does] or in a
subscription definition. If you set a
parameter to Internal, it is not
exposed in any way except in the
report definition.
The real solution to the real problem probably lies somewhere else, but just recreating the report item from scratch instead of using the converted (from SSRS 2005 to SSRS 2008) report item solved the problem described above. The drillthrough report should have the parameter hidden.