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!
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.
This is my first time working with subreports, but I have about 6 months of Crystal experience.
I am constructing a daily report for sales managers, where they can get a summary of each of their salespeople's activity (open orders, quotes, etc.). This report already exists as an individual sales report, where they get more details on their activity, so I'm using a summarized copy of that report as a subreport for the new Manager version.
My issue is
generating the list of salespeople under the sales manager, eg:
"if parameter = managercode then select salesperson where salesperson_managercode = managercode"
Getting stuck on this logic, can't seem to crack it.
passing the above list through the subreport, one at a time. Essentially a loop. From there I want to total everything to provide a Team Total at the bottom.
Any help is appreciated!!
You shouldn't need to worry about the looping structure. The report will take care of that for you. If you have a dataset where each row represents 1 manager, then placing your subreport within a section that repeats for each record in the dataset will allow the subreport to effectively loop through each record in the dataset.
The employees who are supervised by each manager can then be selected by using the "link" between the main report and the subreport. A "link" is defined in your subreport's setup by declaring a field from the database in the main report and a field within the database of the subreport. The field in the subreport should be a Foreign Key that corresponds to the field in the main report. Following the example of managers and employees, your main report would have a dataset the represents Managers. This dataset should have a primary key such as Manager_ID. Then your subreport that represents the Employees would have a dataset that contains columns such as Employee_ID as a Primary Key that is unique for each employee, as well as a foreign key such as Manager_ID that indicates which manager is responsible for the given employee. When linking the subreport and main report you will want to use Manager_ID as the "link" between them.
I hope this helps, or at least helps you get started!
I'm trying to build a report that will returns both a customers information and the services they received. So far how I've broken this report is for the customer information I added a "list" and then since I needed the headers on the left side (text boxes with text) and info on the right (text boxes converted to variables). I drug over each variable from my dataset1 individually.
The second box is a 2nd list with a table inside of it representing only the services performed for the customer from dataset2.
The problem I am having is if the customer exists it populates the 1st list but if they do not have any services then list 2 disappears and the only thing that exists is the customer information list.
Is there a way to still show the 2nd list with an empty table if no services exist for a current customer??
EDITED:
1st Pic - shows the 2 tables I've added to my report. Diagnosis table is in List1 and the Treatment Plan table is in List2.
2nd Pic - shows the refreshed report where data exists for the Diagnosis table but the table/list containing the Treatment Plan... is now missing since there is no data available to populate this table.
I have a SSRS report with two datasets. My report has one table with all fields from dataset 1. Is it possible to show the field from dataset 2 if the id field from dataset 1 = the id field from dataset 2?
I've tried using an expression on the field in the table to point to the field in dataset 2 but there is no link between the 2 datasets which I think I need. are you able to do a select clause within the expression on the report?
any guidance would be appreciated
I have tried the below as the expression but it doesn't work :
=iif Sum(Fields!ID.Value, "DataSet2")=Sum(Fields!ID.Value, "DataSet3") then First(Fields!total.Value, "DataSet3")
Your question is very classic case of SSRS.
You have 2 ways to achieve this
SubReports (Which I personally like)
Lookup functions (which I sometimes find difficult dealing with)
Method1: Use subreport to display one report in another report
.Create another report as the subreport and insert the child row data.
Create a parameter named ID in the subreport.
In the main report, right-click to insert a subreport in the child row.
Right-click the subpeort to open the Subreport Properties, and select the subreport name in the drop-down list.
In the left panel of the Subreport Properties dialog box, click Parameters.
Select Name in the drop-down list of ID, and select [ID] in the drop-down list of Value.
Method2: Use lookupset function in SSRS
In the Expression dialog box, modify the expression to look like this:
=join(Lookupset(Fields!ID.Value,Fields!ID.Value,Fields!Subject.Value,"DataSet2"),",")
The following screenshot is for your reference(The tablix is to use DataSet1):
Refrences:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f30ff0d2-ba37-4bb8-b0a0-a6e06b3273fd/two-datasets-inside-a-same-tablix?forum=sqlreportingservices
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2e6dfb5a-2de2-4d2f-96e5-4cb94543c6ec/asigning-two-data-sets-to-one-table-in-ssrs
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.