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.
Related
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!
I am wondering if there is a better way to have fields displayed in the report headers and footers. Currently we are doing this by adding the field to a tablix in the report body and referencing that in the header/footer
=ReportItems!ItemName.Value
This however means that there are a lot of hidden fields attached to the main tablix used in the report body and if the end user has to edit the report in the future for whatever reason then it is just confusing and complicated to navigate.
The reason that the fields displayed in the header and footer are attached to the main tablix used in the report body is so that we can take advantage of the grouping and page breaks set there so we can make the header update with different data across different pages within the same report
I know this way works and is probabily one of the easiest to implement but we have a lot of fields that need to be displayed in the headers/footers and the body of the report just looks a mess with lot's of tiny columns in the tablix all hidden. It also makes our tablix quite wide with all of the hidden rows that just make the report it self a lot wider than it should be .
Is this the correct way to do it or is there a better more intuitive way of displaying data in the headers or footers?
I can think of two other ways but normally in the header there should just be a title because its just a header. Everything else can go under the header and formated like you want it (with rectangles and page breaks for example).
So first of all you can use the page numbers to manage different headers. Put a textbox in the header and add the following expression:
=IIF(Globals!OverallPageNumber = 1, "This is the header for Page 1", "This is the header for Page 2")
You can also add a paramater to your report, where you manage different states to manage the headers. In the textbox goes something like:
=IIF(Parameters!HeaderParameter.Value = 1, "Sales haeder", "Work header")
The craziest I did was a header with two key informations:
="Sales Report " & CStr(Year(Now())) & " with an overall amount of " & Parameters!TotalsSales.Value & " EUR"
Everything else should go under the header I think. And if you need to display different tablixes with different information but each of them on a different page. You can add page breaks when you add a rectangle and go to Right click > Rectangle properties > General > Add a page break after.
I've not come across anything like I am looking for so either I'm either not asking the right questions (for which I will apologize for re-asking a question) or it's not been asked.
I'm working on a report to print header information onto pre-printed carbon copy forms on a continuous form feed impact printer. The form is two pages and the header for the second page only contains part of the information that the header on the first page has.
I have the first page header working fine. I played with using rectangles and it was printing on target on every other page. The problem comes in when I try to print the page two header.
The way I am formatting the headers is that I have a single cell tablix with a rectangle in the cell. I've measured out where the 11 fields belong for page one of the form and placed them on the form. This all works correctly. Below that, I've inserted a second rectangle with the add page break before property checked. In that rectangle I have two of the fields that are repeated one just above the other (field 1 and field 2). Field 1 is in exactly the same spot as it is on page one. Field 2 is higher and to the left of where it is positioned on page one. The report body has no margins. Positioning is all done directly through the elements themselves. Field 1 sits about 1/16 to 1/8 inch lower than it does on page 1 even when position top is set to 0 (and there is no page margin). I can position field 2 exactly where I want it to be however. If I have multiple forms print out, all the page ones are perfect and page 2 field 2 is spot on but page 2 field 1 is always too low.
I tried separating the rectangles but was unable to connect the dataset to the second rectangle.
Is there a better way to do this? Is there a setting I'm missing that is adding padding to the second rectangle? Any help is appreciated.
Not quite the answer that I was looking for but it nearly fixed the problem. It turns out that the field itself had padding on it. I'm not sure how as I copied and pasted it from the first page but it moved it up to a acceptable position. It is still a bit low but close enough that the requester is happy with it.
I have a field on the footer that may contain more text the the textbox would support. If it does, I need the report to print another page, even if it's completely empty, containing only the footer field.
Basically, if a condition is true, I want the report to print a new page, displaying my footer in it, even if there's nothing else to be printed.
How can I achieve this, preferably with field expressions?
And if you have a solution that's not a field expression (external code for example), could you also point me to the basics of it?
On any block you have the property PageBreak, you can choose begin, end or none. By choosing end, a page break will be insered after the block.
=iif(Globals!PageNumber Mod 2,True,False) this helped me to show (visibility) a text box on even pages only from my footer
Help me please. This thing drive me crazy. It really should be a simple solution but I can't find it, even with Googling.
I have a subreport that display deposit transaction banking statement from account (customer).
This subreport will be accessed through main report that loop all accounts in one branch, so it's like a batch report processing for all customer in a branch. Rendered to pdf and distributed to all our branches.
Since I know that subreports header footer won't work on main report, I decide to move the subreport header into subreport table header and make it looks like it was a report header. But this is one problem I can't solve: there is address box that should only visible on first page for each customer, along with the other header that always visible.
And this will be printed on pre-printed paper, so I cant make the address box outside the other header since the report would be shrunk, without the address box, at page 2 and the rest of the pages from each customer, which will make the table header and the content go up and the positions will not match with our pre-printed paper borders anymore.
What am I supposed to do? Please help, I've been searching andn trying for 3 days and can't find any working solution.
Thanks.
I suggest:
Set the subreport table header row property RepeatOnNewPage to be True (in the Properties window).
Set the subreport table header cells Visibility>Hidden property for the address box cells to be a formula that evaluates to False for the first page, and True for all subsequent pages, such as:
If PageNumber = 1 Then False Else True
This should ensure that the table header is printed on every page, with a blank section the size of the address box included on all pages after the first page.
yes.
the address box is only at first page for each customer since it is for posting address. i cant tolerate address box in each pages of each customer because it would be very awkward.
and i have to maintain the space on page 2 onwards so the report don't collapse (header going up of the paper) and not match with our already-printed (already have company logo and borders) papers.