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!
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'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 need to create a report that is using 2 datasets. One (yellow) is bringing product data, the other (green) is bringing company and quantity data. They can both be linked using a unique ID field.
One product may be used by up to 8 organisations and each organisation may have multiple departments.
Can someone explain how I can build a report to give the excel output as shown in the image.
I am familiar with lookup in SSRS, but not sure how to use this where groupings are required from the second dataset.
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!
I am trying to create a batch report of multiple invoices using SSRS 2008 R2.
I have created the initial invoice report and have it set up with a parameter; the parameter uses an InvoiceID to populate the data within the invoice report.
I have created another report using lists, inside the list contains the information that was in my original invoice report but using a different parameter (BatchID). The problem I am running into with this is that instead of creating a single invoice for each invoiceID it is creating an invoice for each line item within each invoice. i.e.~ Instead of incorporating multiple items based on the InvoiceID (as the original report did) it is creating a report for each of the items.
What would be the best way of running a batch of these invoices? Am I going about this the wrong way or am I on the right track but missing something?
Thanks in advance!
SELECT i.InvoiceId, i.InvoiceNumber, i.BillTo_Line1, i.BillTo_Line2, i.BillTo_City, i.BillTo_StateOrProvince, i.BillTo_PostalCode, i.CustomerIdName,
i.ce_OutstandingBalance, i.ce_BillToDate, i.ce_BillFromDate, i.TotalAmount, id.ProductIdName, id.ce_customeridName, id.ce_CustomerProductName,
id.InvoiceDetailId, id.BaseAmount, id.PricePerUnit, id.ce_rate
FROM
Invoice AS i RIGHT OUTER JOIN
InvoiceDetail AS id ON i.InvoiceId = id.InvoiceId
Once I enter the invoiceID I get my report
My intent is to be able to run the report against multiple invoicesid numbers without having to select the invoice number itself. I have another table that collects the invoiceid's based on a batchid that they are run in.
So far I have attempted to create a subreport with the original report and Create a separate report that uses a list and attempt to group by InvoiceID for each batchid. Though with each of these I have so far been unsuccessful.
I am new to SSRS and have been pouring over documentation from MSDN about SSRS and the different abilities.
For this sort of repeating list, it's a matter of understanding how a list/grouping works.
Lists, Tables and Matrixes are all the same underlying object - the Tablix.
A List is a Tablix with one detail row (i.e. one Tablix row for each row in the Dataset), one textbox in that row, and a Rectangle in that textbox. The Rectangle can have various embedded elements like more textboxes and as such provides a repeating free-form item for each row in the Dataset.
You can see this when you create a List in the designer:
I assume your report query takes a BatchID and returns a number of invoices and their invoice details. I've taken some liberties with your data and created a simplified sample Dataset:
You want the Rectangle to repeat for every InvoiceNo. Currently the Row Group has no grouping item - change this to InvoiceNo under the Group properties and expand the Rectangle as required.
You can start adding in elements such as textboxes for the Invoice level items, something like:
Note that the left side of the Tablix has changed from lines to a bracket - this is because a grouping item was added to the Row Group.
This will repeat once for each InvoiceNo. Now we want to add the line items - you can do this by dragging a new Table into the Rectangle. Since we have a Row Group in place this table will only display items in that group:
When run for the sample data, this gives an ugly but functional repeating invoice report:
This could be tidied up as required, and page groups inserted between Group items in the Group properties as required.
Hopefully this at least gives you a rough idea of how you might go about your task.