Creating a Batch Report - sql-server

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.

Related

SSRS - 1 Stored procedure called executed multiple times

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.

SSRS report show static headers on the left and group by ID

I have the following DataSet on a SSRS report:
SELECT
VariationCode.Code
,VariationCoding.Comment
,VariationCoding.SubmissionDate
,VariationCoding.Id
FROM
VariationCode
INNER JOIN VariationCoding
ON VariationCode.Id = VariationCoding.VariationCodeId
WHERE VariationId = #VariationId
I am showing static headers on the left and data on the right which works fine but I'm struggling to group the results by ID and show them as a separate table per grouping.
Grouping the row by parent using VariationCoding.Id shows one table with no grouping at all. I suspect having the headers on the left is the problem since most solutions I've seen have the headers on top.
How can I show static headers on the left and group the results by VariationCoding.Id in such a way that each result will be displayed in a separate table?
group the results by ID and show them as a separate table per grouping.
You may want try Page break option, from Group Properties, screenshot for your reference.
I ended up using a list control to solve the problem as described on Microsoft docs -
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/create-invoices-and-forms-with-lists-report-builder-and-ssrs
A list data region repeats with each group or row in the Reporting
Services paginated report dataset. A list can be used to create
free-form reports or forms, such as invoices, or in conjunction with
other data regions. You can define lists that contain any number of
report items.
By creating a table with static columns on the left and nesting it inside the list control, I was able to bind the table data columns to the list data source and this grouped my custom table per record.

SSRS - Group Columns Together

All:
I have the following data (see Raw Data attachment). Inside my SSRS Report, I have a column for "Name / Stream / Offer One / Offer Two" (Name is the column for the "Value" column shown in the image).
I need my SSRS Report to display one row of the "totals" for each Name. Then under this, I need a row for each Stream associated with the Name that displays the values for that stream.
For the SSRS Output (please see second screen shot). The data loads into my tablix, but I need one row for "BAG-CV" that displays the total for that Name. Then under this row, I need a row for "AR" stream with the data for.
If you see Name: JAC-FL, it has 5 streams listed under it. So I would need one row for the total of JAC-FL, then 5 rows under it listing all the streams associated with this name.
Hopefully this makes sense.
The concept that you are describing is a nested parent/child group (two levels of grouping in a single table). This is quite easy to do and I'll walk you through the steps for your particular scenario thanks to the helpful description and screenshots that you posted.
Create table: I would advise always starting with the innermost grouping and building the table outwards. In your case, the lowest data granularity is Stream/Offer1/Offer2 as these are displayed as raw details with no aggregation:
Add Parent Group For "Name": Click on the group at the bottom (or in the table) and add a parent group to the current table details group, making sure to include a group header (for the sum):
Screenshot #1:
Screenshot #2:
Add Fields: Add the additional fields to your table, ensuring that the middle row is using SUM aggregation as per the screenshot:
Results: You should see the additional header row on the parent group with the desired SUM.
Cleanup: The example above just creates the most basic and bare functionality. I would suggest cleaning it up and adding a visibility toggle on the details group:
PS. I realize you probably aren't in control of the database schema, but wow, exclamation marks in column names would drive me up the wall :)

SQL Server Reporting Services 2005 how to create nested groups

I know it's old technology (ancient now), but it's what I have to work with due to work.
I am able to create a Group and report and link it to a textbox to provide a collapsible report, with master data and detail data.
What I want to know, is it possible in SSRS2005 to create another sub-group to the first group?
i.e. Master record -> Detail -> Sub-details
Every time I try and add another detail row for example I only get one row of data in the sub-group, because it's tied to the Details Grouping. I cannot explicitly say "report grouped by this other subgroup" (where it offers you to create groups in the Group list).
Yes I am trying to do this in a table.
This is what I am after...
[+] Col1 Col2 Col3 Col4
[+] data data data data
Col1 Col2 Col3 ...
data data data ...
...
...
The [+] is what I want to set up to allow the expansion of another group within the first group.
The answer is not to try and pack too much into one reporting object. In this case the Table object.
I managed to have far more flexibility by placing the tables and fields inside a List object.
Try these...
Drop a List item into the report
Define the Dataset to your main dataset that contains all the data.
Note: For this to work you need a query that have as much as the master and detail data inside as ONE query, so obviously your master data will repeat as deep as it has to, to get to the lowest common dataset, which in my case was the action items per student.
The List object will act as the Master data reference for all your other objects inside of it.
Now you can play! Drop in a few textboxes to show the data for the master data you want to only show ONCE per "logical record". I'll let you ponder what that meant!
Now to show subgroups, you'll need Tables for each one. Drop a Table object
In each table (group) don't specify a dataset, as I said above, all the data comes from the List.
But for each table, you'll need to define your Details Grouping. Go ahead and simply state the group parameters you require for the sub-group. So in my case, I want to display ONE row of Students, but any amount of Actions each student has. So place a StudentID for the student and an ActionID for the actions as a combined grouping.
Repeat the above for any other groups, and define their groupings so you don't get repeatitive data. One table could only have one pivot or group, so just define the index for that inside the Details Grouping. Do not use the Add.. feature to add groups, because you'll be adding groups within subgroups and go into another level again! Beware.
I hope this made sense.

tablix returns only 1 record for dataset

I have a tablix on an SSRS report:
When I run the report it only returns 1 record!
I did a sql server trace, and the query that is being executed is returning 14 rows.
On the same report, I dropped another table, and put just one field on it, and it returns 14 as expected. I noticed that the difference between the one that works and that one that doesnt is:
How can I get those 3 horizontal lines on the one that doesn't work?
What could be my issue? What did I do wrong?
The screen shot shows you don't have any groups. You deleted the details group from the Tablix. You can add it back in by inserting a new group or building a new tablix object from scratch.
To add a group, click on a cell in the row that should have a group, in this case the [ReferredBy] cell. Select Add Group -> Row Group -> Adjacent Above. If your data is already grouped at the correct level of granularity, then select Show detail data in the Tablix Group screen. This will add the details triple bar in a row above your current row. If you need to group on something, then pick the field to group on. This will add a ) in a row above your current row. Copy and paste the contents of the cells in your existing row into the new row and delete your original row.
One row when you expect multiple sounds like a grouping issue. Debugging something like this I would create a new table element below the current one and drag and drop a single column from the dataset. If it returns 14 you know it is not the dataset being evaluated as a problem but the table's expression. If it is also only returning one you probably have a predicate, filter expression, or parameter setting limiting the scope down as well.
Probably, you set the expression for Textbox and not for the RowGroup.
Just find the Group Properties then put the same expression in Group On.

Resources