I have a summary report that passes information to a detail subreport in SSRS. The subreport accepts 4 parameters:
From Date (DateTime)
To Date (DateTime)
District (Multi-value String)
Item ID (Multi-value String)
The Item ID parameter is a cascading parameter that depends on the From and To Date. I am having an issue with the parameter not being set when values are passed from the main report to the subreport that are not within that date range. Take the following as an example:
Group Item ID
Banks ABCD 01
ABCD 02
ABCD 03
ABCD 04
The values above are defined in a setup table used in the main report. The idea is that the Banks group should have those Item ID's associated with them. Those values are passed to the subreport via the Item ID parameter. The problem is that when the parameters are passed to the subreport, not all of the Item ID's will necessarily be in the data for the given date range. In this case, SSRS does not select any of the Item IDs when the subreport is loaded.
Some additional information:
The Item ID parameter needs to be set up as a cascading parameter in this way because there are over a thousand different values and SSRS does not support more than 1,000 items in a multivalued list.
The table that both reports are using is a transaction table so the queries can be slow. I would like to avoid having to execute another dataset to determine which Item ID's are actually within the date range from the main report (since this is going to happen anyway when the subreport is loaded).
If all 4 of the Item ID's are available for the given date range in the report, it selects them correctly.
I was thinking it may be possible to create a running value type field that concatenates the Item ID's together to a string in the main report, then split it and pass it to the subreport. This would get the item id's actually used in the query without having to execute the query another time. I thought it may also be possible to trim out the values in the subreport if they aren't contained in the parameter value list? I'm guessing, if this is possible, I will need a hidden parameter to do this work then set the main parameter from the hidden parameter.
Any thoughts on how I can handle this situation? Let me know if you need any additional information.
Related
I have a report that returns the description of a product sheet from the product reference.
The product sheet contains: the description of the product, dates, the history of the product, ...
The data comes from a stored procedure called with a SINGLE reference.
The report criterion is currently a single reference.
So everything is ok.
I would like to pass a list of references separated by, for example, a comma and run the PS as many times as there are references to query and make as many product sheets as references.
I hope i was clear.
A big thank you for your answers.
It sounds like you already have a report that produces a result for a single reference. If that is true then the easiest way is probably to use your existing report as a subreport.
In brief...
You will need to create a new report, add a dataset that contains a unique list of references that you want to produce reports for (this could be parameterized too if required).
This might be as simple as SELECT DISTINCT RefID FROM myTable
Next add a list control to your report and set its dataset property to the dataset you created above.
In the list's 'cell' right-click and insert a subreport. Now right-click the subreport placeholder and set subreport to be the name of you original report. Set the parameter to be the fields from your dataset above (in this exmaple [RefID]).
The list will produce one subreport per entry in the dataset. You can set page breaks from the list control if required.
If this does not help, let me know and I'll update the answer with more details.
I have built a report that has 2 sections populated based on a parameter. Once the parameter was chosen both sections populated correctly.
The sections are:
Title -> this is the parameter chosen from a dropdown
Department -> populated based on parameter
Division -> populated based on parameter
-------------------------------------------------------
System | Access -> table populated based on parameter
All the data is stored in one table; each Title has one Department, one Division, multiple Systems, Access.
I need to change the SSRS report to generate all the data at once without parameters, meaning it has to loop through each Title and populate the rest of the information, generating different tables on every page. Is this even possible in SSRS?
If necessary modify your query such that it returns all the rows for all the titles. Then:
Create a List which you group by the Title/Department/Division and show the Title/Department/Division using TextBoxs.
Create a Table within your List and reference the same dataset and it will automatically display the rows associated with the current group being displayed in the List.
I have two task in hand to achieve in a single report.
Application URL filtering - One ListID will be passed in the URL to filter the report. I achieved this by having #id as parameter for my datasets. In this scenario I only had one parameter in place.
Reporting Server filtering - For users who don't have access to application/db, they can go to the Reporting server and Select a 'ListName' from a dropdown parameter(#ListName) that fills the List ID parameter.
I achieved this scenario by cascading parameters and having two datasets one for independent dropdown parameter(ListName) another for dependent parameter(ListID).
But since I cannot filter the report based on ListName from the application, I need a way to achieve both in the same report. When I try to filter the report using '?id=123' from application URL it does not filter the report.
You don't need two parameters, you are only ever need to filter on ListID so this is the only parameter you need. You only use ListName to look up the ListID.
Let's say your dataset for the list parameter values looks like this:
SELECT ListID, ListName FROM Lists
Link this Dataset to your ListID parameter's Available Values.
Parameter objects have a Value property which is used to run the query and the Label property which is display the list names to the user. Map ListID to the Value and ListName to the Label.
Now the application can simply provide a list id to the report. However, when a user runs the report, they will see the list names. When they select one, the corresponding ListID will be provided as the report parameter Value.
I have an SSRS, which has Games. Within each game, there are multiple teams, and then they are classified as offensive teams and defensive teams. So there is a game, then there is game detail. Within that there are multiple teams, and then information about the teams, regardless of whether they are offensive or defensive. Then if they are assigned as offensive, they will have an offensive record and ID. If there are defensive, they will have a defensive record and ID.
I set up a main report, based on a stored procedure, which has the game, and main game details. Then I created a sub report for teams, with details for the teams, regardless of whether they are offensive or defensive. This is a game-team record. Multiple per game record. So the heirarchy and report/subreport set up is as follows:
Game (stored proc parameter passed as GID - game id)
Game Teams (stored proc with same GID parameter)
Game Teams - Offensive (stored proc with same GID parameter)
Game Teams - Defensive (stored proc with same GID parameter)
In the game report, I have a tablix, with the fields , and then an extra tablix row, with columns merged. I put a subreport object in there, and set it to the Game Teams report object.
The subreport properties has the parameter set Name GID (matches subreport parameter name) and value = ID (which is the GID field).
That Game Teams report has a tablix with it's detail fields, and then 2 extra tablix rows, each with columns merged. One has the offensive report set in a subreport object, and the other has the defensive report set in a subreport object. Each of those has the same GID parameter from their stored procedures, and then I set up a GTID parameter, and link those in the Game Teams report to the GTID field in the Game Teams dataset.
I can get the reports to run, but the links don't seem to be pulling the data correctly. I have been researching this all over, but it is so confusing.
when I set up the GTID report parameter in the Game Teams - Offensive/Defensive reports, I don't see how I tell the report that when this parameter is linked to the Game Teams report, the subreport should be filtering the dataset results to the GTID field.
I hope what I'm saying makes sense. This is my first time trying to do an SSRS subreport, and it is so confusing. I have done them in crystal reports, in the past, and in Access. You link a field to a field. I don't get why you don't do that in SSRS.
I don't know what you do in Crystal, but in SSRS it's pretty simple.
In the Sub-Report properties, click on the ellipsis in parameters and you will get a dialog box. For each parameter that the subreport expects (they are in the name column), you supply a value that tells the report what to pass to the subreport for that parameter. You can use the fx button next to each value to help you build the expression.
If you have tried this and not gotten the expected results, you can show us a screenshot of the Parameters dialog box and explain what you're trying to get.
I figured out my problem!!! I created the report parameter in the subreport- GTID. To link it to the field in the subreport, I went to that report's dataset propertys, added a filter, chose the GTID field from the data set fields, chose "In" and then clicked the fx and chose the GTID parameter value.
Once this is set, you cannot run the subreport on it's own, unless you leave that report parameter visible, so you can specify a value.
Everything else was right, on the main report, except that it's good to have your main report grouped, and then have a detail grouping, if you have stuff in a table or tablix. I put the subreport in a detail row, with all cells merged. I set the subreport properties parameter to add a parameter linking the GTID sub-report parameter, to the GTID field in the main report's data set fields.
Voila!
When producing a list of available parameter properties, rather than manually typing each persons name in one by one, is there any way of just populating the data from the table/view which holds all the possible names?
I assume its in the circled box however all that does it let me point to a dataset and then field which I have tried selecting StaffName (being the field that is the one I'm using) if I then run the report it falls over.
Add a new dataset to the report, maybe called StaffMembersDS. The SQL for it might look like:
SELECT Id, Name
FROM StaffMember;
Then assign Name to Label and Id to Value.
BTW if this is related to your last question you're going to run into the trouble that when a user picks a staff member name from the drop down list they are picking only one value. So for your case you might want the Value field to be tied to Name as well as the label. That would allow you to use the query in your last question - SSRS Parameters - which collects related Id values.
SSRS's concept of a query is largely tied to a data set that you define in Report Data.
When you choose 'Use a query', you should be choosing a pre-defined query from Report Data. Of course, the good news is that you can define these yourself.
So let's take your example. You want your possible parameter options to be StaffNames.
Create a new dataset in Report Data. It should return all possible staff names for your report.
Something like:-
SELECT DISTINCT
StaffName,
StaffID
FROM
MyReportViewOrTable
Once you have defined this dataset, you should be able to use it as a source of parameter values.