Summarize Tablix on Each Page - reporting-services

I am using SQL Server Reporting Services 2008 to generate invoices. The user selects a batch and each invoice in the batch should print out 1 to a page. Each invoice should contain the summary of charges at the bottom, preferably in the footer to keep a consistent position.
Problem is, it won't allow me to put tables or subreports in the footer. All I can do is put text boxes, but the only data I can get in there are aggregates pertaining to my dataset as a whole. I can't get subtotals for just that invoice within the batch.
Basically my setup is a tablix that is grouped by invoice number with a page break between instances of the group. This ensures each invoice prints to its own page. But when I try to add a text box to the footer to subtotal THAT invoice, my only option seems to be First(Fields!SubTotal.Value, "DataSet") or some other aggregate. I need the subtotal for THAT invoice number whether it be the 1st or the 5th.
I don't know if I'm explaining this very well. I'm sorry if this doesn't make any sense.

I suggest you change your approach a little bit:
Instead of adding a subtotal outside of the tablix, add a total to the bottom of the group. Insert additional lines in the group, but outside of the detail(or subgroup) rows that are repeating within the page.
Page footers aren't very tightly connected to the data or its layout, so they will be trickier to keep sub-totals within. If you really need to do it this way, then you'll need to keep a running total in some embedded code in the report. Start with this example and add additional code to zero out the running total at the beginning of each page.

Related

In SSRS is there a way to use newspaper columns and still have a new page per group?

My dataset is grouped by customer then itemtype and then the details are the itemcodes and descriptions.
I am using the Newspaper column setting so that the list of items continues on to the right side of the page instead of moving on to the next page.
My problem is that I want to start a brand new page for each customer. Since SSRS treats each column as a page break, I get a page where one column belongs to one customer and the next column belongs to another.
I have tried the page break setting on the different group and the tablix properties to try and force a double page break to happen with no luck. I have also tried to drop a rectangle into the table and use the page break setting there, also no luck.
Any help would be appreciated.
Thanks,
Jessica
I've not used the multi-column layout so I can;t directly comment on that but what you could potentially do is use a subreport.
If the following does not help, post a sample of your data and your current report design and I'll post a full answer.
In short, create a report that only handles a single customer, so it will need to have a parameter passed into it that identifies each customer such as a CustomerID.
Once you have the report working with a single customer, create another report.
On this report create a dataset that just contains a list of customers you want to report on (so a list of CustomerID's for example).
Add a table to the report and remove all but a single "cell". Expand this cell to be roughly the width of your subreport (it does not have to be exact).
Set the dataset property of this table to the dataset containing your list of customers.
In the remaning cell, right-click then Insert >> Subreport. This will fill the cell with a subreport control. Right-click the subreport control and set the subreport to be the sub-report we created earlier that handles 1 customer. In the parameters, set the CustomerID parameter to the field from your customer list dataset.
Finally, right-click the 'details' rowgroup and set page breaks to 'between each instance'.
This will generate one subreport per customer and put a page break between each.

Can you link multiple tablixes on a key field in a single SSRS report?

I am creating a report in SSRS to show evaluation scores. It has three sections, and I need to link them all together on the PreceptorID field (2108 in this case). The top two sections are from the same query. I am filtering the results in each one to separate the counts because they have different column names. The third section is a subreport showing comments from evaluators. It also has the PreceptorID field in the data but is not displaying it. It has two parameters that should be populated by the main report query, but that does not appear to be happening. The report is returning all comments instead of only the ones with the matching PreceptorID.
This first image is from Crystal Reports showing how the finished product should look.
This is what I am getting from SSRS. It is showing counts for multiple people at the top. The counts in the middle are actually correct. They are all for the one person. The next person's counts are on the next page. The comments at the bottom are also not filtering on the one PreceptorID.
This image showing the subreport parameter that should be linking it back to the main query.
How can I tell all three sections to only return data for the same person on one page, and another person on the next page?
I would redesign the report structure slightly. This is only my personal preference, there are several ways to achieve this but I find this way easier to manage and maintain.
You'll need two subreports and a master report.
You already have the 2nd subreport so no extra work required there.
I would take you current report, strip out the link to the current subreport and change it so it only processes a single person (just like your existing sub report).
So SubReport1 will have the two tables from your current main report only. It will only accept a single person as a parameter (or pair of parameters in your case)
SubReport2 will be your current subreport. Again it only accepts a single person.
Next create a new report. This will be the master report.
Add a dataset that contains just enough info for list of people you want to report over. So the dataset query might be as simple as
SELECT PreceptorID, ClerkshipID FROM myTable ORDER BY PreceptorID
Add a table to this report and set it's dataset property to the dataset you just created.
Change the default (details) row group to group and order by whatever makes each record unique (maybe both the two columns listed above, may only one will be required, only you will know this).
Right-Click on the row header to the left of your table and do "Insert Row => Inside Group Below".
Remove all but one column
You should now have a table with 2 rows per group.
Right click the top cell in the group and do "Insert => Subreport", go to the subreport properties and point this to SubReport1 (or whatever you called it) and set the parameters has you have done previously.
Repeat this for second row, this time pointing to your second subreport.
In the row group properties, set page breaks to "Between each instance"
That should be it. This was done from memory so might not be 100% but based on the info in your question you should be able to work it out from here.
Things to check if this is not working
Open each subreport and test it by passing in parameters manually. Each subreport should only be returning data for a single person.
The master report should have a dataset that returns each person once i.e. if there are 10 people in total this dataset should only contain 10 rows.
The table in the master report should contain only two rows
Both rows must be EITHER within the same row group, or, if you have no other row groups, they will both be in the detail row group.
The report design should look something like this if you have a row group by person
or like this if you only have detail rows.
Finally, make sure the parameters you pass to your subreports are the Field values from your master report's dataset, NOT your master reports parameters.

SSRS - Prevent pagebreak in the middle of a row group

I have an SSRS report that gets exported to PDF and then printed on to paper. The problem I am having is that I am getting page breaks in the middle of a group.
I have MetricGroup - MetricSubGroup and Details. Those are my Row Groups.
I have several different MetricGroups in the report.
I need to make it so that my report will not break in the middle of a MetricGroup.
So right now I get lets say 2 metric groups and half of the 3rd metric group on page 1. Page 2 contains the second half of the 3rd metric group and so on.
I need SSRS to push a metric group to the next page if the metric group does not fit entirely on the current page.
Is this possible to accomplish?
You need to use the KeepTogether option - but bear in mind this is a "best endeavours" process - for instance, you couldn't keep two thousand rows together on one page.
Another approach is to force page breaks and certain parts of the report.
To elaborate a little more on the previous answer, specifying KeepTogether = true for any given tablix member will try to keep all elements of that tablix member together.
So if you specify KeepTogether on your MetricGroup tablix member, SSRS will try to keep all elements of that tablix group together, and when it fails because the report spans multiple pages, it will page break where it likes, resulting in groups breaking up over pages.
If, however, you specify KeepTogether on your MetricSubGroup tablix member, SSRS will try to keep all of the subgroups within a MetricGroup together, which will result in the parent MetricGroup trying not to break on a page if that were possible.
I'm spelling this out explicitly because there's a common degenerate case here - a report without any groupings but with a complex details tablix that generates with multiple rows per data record. Trying to specify KeepTogether on the details tablix will try to keep all of the details together, introducing unexpected page breaks.
In this case you'll need to generate a details group as the immediate parent of the details tablix and group by whatever the report identity is. Then you can specify KeepTogether on the details tablix and it will keep together only the members for one single data record.

column break versus page break ssrs

I'm trying to write a report that reports based on the time of day (shift) and the day itself. I'm using three columns in the report, which I set in the reports properties without issue.
The issue that I am encountering is that after every day, and every shift, I must start a new page. So I put in a page break after each event, but all that I get is a column break.
How can this be circumvented to get an actual page break and not a column break? Why would they make it a column break to begin with?
I am using Visual Studio 2008.
Thanks!
You should look into using the Lists container in SSRS, it allows you to easily group by fields of your choice and then break in between each group. It is a common choice for reports that require one page per group, with data presented for each group. Inside your list container you'll be able to add a matrix or table to represent your data, in addition to any text boxes or other objects you need displayed on a per group basis. https://msdn.microsoft.com/en-us/library/dd239330.aspx

Page headers on SSRS subreports in grouped table

I have a multiple page report. It takes 3 parameters: start date, end date, and job number.
They have requested the ability to run this report for all jobs or multiple jobs at a time. I created a second report and made the job number parameter allow multiple values. I then created a table, grouped by the job number, and added my original report as a subreport in a row.
This all works great. Except that the page headers from the subreport do not show. I can easily get the info to show at the start of the report by adding it to the table grouping, but I can't figure out if there's any way to get it to show on each page.
If each job's report is 4-5 pages and they run it for 25 jobs, they really need to have the corresponding job number on the top of each page. Some people have suggested putting it as the table header and checking the option to show on each page, but that won't change per job and I don't think it works if the subreport spans multiple pages anyway.
Any ideas?
Usually headers and footers in sub-report will not display in the report.
The best way is group by "job number" add a row above inside the group, put job number in that. Then go to job number group properties and select "Page Break" for each instance of group.