SSRS: Need the group footers to be at the bottom of the page - reporting-services

I recently converted an old Crystal report into SSRS. I'm almost done but have one remaining problem. In Crystal the group footers all seem to be anchoring at the bottom of the page while in SSRS they are directly below the detail leaving a bunch of white space below the group footers.
I've Googled this so many times and find very few articles that deal with the group footer, it's always page or report footer. What I'd like is the detail section to consume all remaining space. I've tried making it bigger but when I have multiple lines in the detail it has a bunch of white space after it. I tried increasing the height of various group footers (I have 3 groups in this report) but it seems to shrink down to content. I've checked the group properties, report properties, every property page I can find but I can't seem to find something to anchor them to the bottom. I can set the vertical align of one element to bottom but I need all 3 group footers to be at the bottom.
I've attached images of both reports, the SSRS one shows what I need anchored to the bottom while the Crystal one shows what it should look like. I feel like this should be an easy thing to do. The only solution I've seen is to put a placeholder that has the height set to a formula with like 6 values in it to try and calculate how much height it should occupy. This seems like a ridiculous solution.
I'm not sure if it matters but I'm saving these reports in the rdlc format since they are served up by an API. I edit them in rdl then copy them over and rename the extension.
I tried including the XML but it goes WAY over the character limit of a question (200k+ characters). If someone needs that I'll have to find a way to send it.

SSRS is not good at doing this kind of spacing.
We can trick it however by the doing the following.
First.. create a subreport - let's call it
"Insert Blank Lines"
I like using stored procedures for my data sources -
So here is my code for the report:
ALTER PROCEDURE [dbo].[report_getblankrows](#N AS INT)
AS
BEGIN
DECLARE #Numbers TABLE
(
Number INT IDENTITY(1,1) PRIMARY KEY CLUSTERED
)
WHILE COALESCE(SCOPE_IDENTITY(), 0) < #N
BEGIN
INSERT #Numbers DEFAULT VALUES
END
SELECT * FROM #Numbers
END
Pretty much all it does is return rows for the number that is supplied as the parameter.
Now in your insert blank line report.. use this as the data source and place the numbers field in the details row group.
The report itself need not be big.. something to fill the space in and set the font color to white so it's not visible.
Now in your main report.. lets say you have a data set called "invoice" (for all your invoice details) . you obviously have a detail line.. immediately After the detail group, and before your "Footer" summary (the bit you need pushed down); Merge all fields into a single line and then insert a subreport in that line and point it to the "Insert Blank Lines" subreport. (shown below)
Now go to the subreport properties -> Parameters and Add a parameter..
Name N
Value = 10 - countrows("invoice")
This is the trial and error part. The first number (10) is just a guess to start with.. run your report and see how far down the summary of the invoice is pushed down.. a bit of a trial and error will be needed to get the correct number.. Not enough blank lines, increase the first number (10)... too many, just decrease it.. to suit.
If the invoice has enough lines to fill the page.. the returned number is in the negative.. so the subreport will not populate any rows and no blank spaces will be created.
This is the best I could come up with and have used it for years. Good luck!

Related

Displaying page number in body of RDLC

How do I get Page Number in Body Section of RDLC report. Globals!PageNumber can be used only inside either Report Header or Footer. What if I put Row number to my dataset and get the record number.
Limiting the number of records per page and do the visibility calculation based on the records number is the best solution so far that I've heard of.
Can anyone educate me on this logic?
Or is there any other workaround for this?
P.S:
Other so-called solution like using Custom code is not giving you the correct page number. It will always show 1.
There isn't really an easier way to get the page number in the body. I think working with the dataset row count is the only reliable way.
What I have here is a short SQL statement to get Project Status information:
SELECT * FROM PROJ_STATUS
So I'll add the row number as a field, and also divide it by the number of records I want per page and add 1 (giving me the page number of each row)
SELECT * , ((DENSE_RANK() OVER(ORDER BY PRS_ID) -1) / 3 ) +1 AS [CountRow] FROM PROJ_STATUS
Now in my report I've got a table showing the status names and if they are active or not... I'll also add the page number as a column.
Next put a list in the report and put the table inside it.
Then click the top left square corner on the list and in the properties window set the dataset to the one you are using.
Then right click on the row group in the list and set the grouping to the page number column.
And put page breaks in between instances.
And there you go!
Reason why the -1 for #4Star. See that without the -1 the 3rd row is on the second page.
If your dataset is a row per whatever you want to get page numbers for, then
=RowNumber("DataSet1")
will work.
This is the same as using
row_number() over (order by (select null))
as it gives you an arbitrary ordering for row numbers.

How can I add TextBoxes to an existing Matrix in an SSRS project?

Why is it that a control that appears in the property list in a BIDS project is not represented in the corresponding .rdl file?
Let me step back a bit; I'm having a heck of a time trying to figure out how to add items to an existing report, either via the XML (.rdl viewed as code) or on the design surface. I can click on a rectangle on the design surface and see a column row above it:
And if I click on the "pipe"-separated segements on that column heading row, I see "MatrixColumn4", "MatrixColumn3", "MatrixColumn2", and "MatrixColumn1" in the designer; for example, here's MatrixColumn3:
However, only one of these columns appears at a time in the Property list - if I select MatrixColumn3 on the design surface, MatrixColumn1, MatrixColumn2, and MatrixColumn4 are not there. The same holds true for selecting any of the others - it turns up temporarily in the Properties list but "hides" all the others:
Stranger yet, when I search the .rdl file (viewed as XML) for "MatrixColumn1" (or "2" or "3" or "4") they do not exist there. In fact, the only reference to "MatrixColumn" in the entire file is this:
<Matrix Name="matrix1">
<MatrixColumns>
<MatrixColumn>
<Width>1.67609in</Width>
</MatrixColumn>
</MatrixColumns>
. . .
This seems exceedingly bizarre - shouldn't there be four sets of <MatrixColumn></MatrixColumn> there?
I want to add another column heading, with a Textbox-as-label and a Textbox below that to display dynamic content, but how can I do it without adding another column heading?, or at least making room for this new column?
I can increase the width of the matrix ("matrix1") by dragging it or by increasing its Size.Width value, but its existing contents expand with it, giving me no room to add TextBoxes inside of it.
Maybe I'm approaching SSRS from a completely wrong mental angle, as I don't see much of a connection between what the report generates and what I see on the design surface and in the XML.
To add another column to a matrix right click the column header and Select Insert column. Then choose either inside group (left or right), or outside group (left or right).
A column created inside the group will repeat for every item in the column group
A column created outside the group will only appear the once to the left or right of the grouped columns.
Are you sure you are referring to a matrix (dynamic columns and rows) and not a tablix (dynamic number of rows only)?
The process for tablixes is the same as for matrixes as described above, just without the inside/outside group option.
Either method described above will include a new column with a single text box to label the column with, and another text box underneath to put the detail in.
You can also do this process by dragging a field from your dataset in the Report Data panel to the appropriate location in your existing table.
Please let me know if this helps, or if I've misunderstood your question and you require a different solution.

SSRS - Adding empty cells under a tablix to fill empty spaces on the page (if any)

I work with ssrs with a dynamic row data in matrix/tablix. There is possibility when I have more than one page (say it two pages) where the data just fill half of the second page and leave a blank space below (half page blank space on the second page). How is the way to fill this blank space with empty rows? (whether rendering empty rows in the tablix, or inserting background image, or anything. I don't have any solution yet as it is dynamic data with many possibilities of the blank space size on the page)
Unfortunately there aren't any settings in the reporter that support this behavior. There are however several workarounds you could use to get the wanted result.
[1]
You could determine the amount of rows that fit on the first page and on the second page, just in case you have items above the
table on the first page. Before you send the datasource to the
reporter count the total rows and check if it exceeds the first page.
Then calculate the number of rows missing to fill an entire second
page (or third/fourth... if you ever get more data). Finally you add
empty rows/objects at the end of your datasource, which will of cource
cause the pages to be filled to the end.
As was pointed out before, this solution is only possible when working
with fixed row heights. If certain columns can have multi-line cells
then these could be checked as well and taken in account when
calculating the number of rows being displayed on the page. This makes
it slightly more complicated but is still a valid solution if you can
predict which columns might be troublesome.
[2]
A second solution would be to hide the table borders and place the table inside a rectangle that spans the maximum size of the
page. The borders of this rectangle can be used to display the table
outer borders and columns can be displayed by adding lines inside the
rectangle. This will cause the columns to fill the last page of the
report automatically. Unfortunately this isn't a solution to display
horizontal grid lines.
[3]
A third approach is adding an extra table directly below your table
with the same size of columns. Using the same method as from the first
solution you could fill the second table to represent the empty rows.
You'll probably have the same issue as with the first solution when
dealing with multi-line rows though.
I believe solution [1] and [3] will offer the most exact solution, if you're willing to do the math. If you don't want any horizontal lines then I suggest using approach [2].
Using an image to overlay the borders is of course another option but then you'll have the same issues when dealing with the multi-line rows. If you plan on working with fixed row heights, where you leave space for multi-line cells then this is becomes a valid approach but so does solutions [1] and [3].
Update:
If you only need the filled pages for printing you could make sure you add enough empty rows to fill at least the entire last page, these may go to a new page (1 new page, not 2... you can use a simple calculated guess for this) and exclude the last page when printing.

SSRS RDLC character appears partially hidden in report

I'm new to SSRS reports, and I didn't write this report, I'm just trying to fix it; and I've had no luck searching for anyone else suffering from this (too many false-positive matches).
Part of the data for a field is being rendered in a way that leaves half of the first character invisible. Perhaps the best thing to do is to show a screenshot of the problem (see the data in the final column):
StackOverflow says I don't have enough reputation to embed the image; but it's here:
http://i.stack.imgur.com/1YtcB.png
The "8" character is being chopped in half. I don't understand why the data isn't forced inside the 2pt padding, or why it doesn't split the date value between the date and time.
By the way, I suspect there is little value asking why the penultimate column looks OK: the columns are different widths, and the penultimate column is an expression returning a DateTime whereas the final column has to handle the possibility of the DateTime being null.
The RDLC file is here (requires you to download the file; suggestions of a better alternative are welcome): http://www.filedropper.com/markerprogresssummarybycomponent
It looks like it's attempting to fit as much of the date/time on the same line without wrapping as possible, which doesn't necessarily fit in that cell.
2 Suggestions:
Increase the width/padding of the cells that are cutting off text so the
entire date/time fits
If it's not a problem to have the time shown on the next line, you could force it to wrap at the time part, thus eliminating the issue:
=Replace("8/6/2015 12:35:02 PM", " ", chr(10), 1, 1)

SSRS - rsMultiReportItemsInPageSectionExpression Error

The Particulars:
I have a report that displays information about invoices. There is a page break between multiple invoices (each invoice gets its own page). What I want in the report header is the result of this expression (ex. "June, 2009"):
=MonthName(Month(ReportItems!textbox1.Value)) & ", " & cstr(Year(ReportItems!textbox1.Value))
But I get this exception (textbox2 is in the header):
Error 1 [rsMultiReportItemsInPageSectionExpression]
The Value expression for the textbox
‘textbox2’ refers to more than one
report item. An expression in a page
header or footer can refer to only one
report item.
First of all... Why would that even matter?! Second of all... How can I work around this strange restriction?
The Big Picture:
The reason I'm grabbing the text from another textbox is to work around the restriction that you can't use data fields in a header or footer. So there's a hidden column that shows the invoice date next to every transaction. Then the table header has the expression:
=First(Fields!InvoiceDate.Value, "table1_Group1")
This seems ridiculous and I hope I'm just doing something wrong. Yes I realize I could simply have a "month" and "year" text box in the header but that pushes the complexity way too high for the simple requirement of showing an invoice date in the header of a report.
One wild guess would be that textbox1 exists for every page of your report. So if you have two invoices, you'll have two pages and thus 2 x textbox1, so SSRS does not know which one to refer to.
You might try to play with report parameters as described here. If nothing else helps, I guess you'll have to put the invoice ID into the report body.
I came back to this issue and found a way around the buggy behavior in SSRS.
All formatting can be done inside the column header instead of up in the page header. The text box in the page header simply grabs the already formatted (and complete) text from the column header all at once. No more multiple references.
This is a hackish workaround for a strange limitation which is the result of a hackish workaround for another strange limitation. But it works.