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.
Related
Here is the similar imageI'm trying to create an SSRS report using SSRS 2008 R2.
I have a requirement to show different headers in different pages based on page number. For example, I need two textboxes to be shown in all the pages except page-1. So I put them in a rectangle inside report header and set the visibility(expression) based on pagenumber.
This works fine but it leaves a lot of white space in the first page header as it is hidden. How can I get rid of the whitespaces?
I tried putting those 2 textboxes out of the header, but I'm unable to hide them based on pagenumber, as the pagenumber global variable can be accessed only in header and footer but not from the body.
Is there any other approach to hide these textboxes on first page and show on all other pages?
Thanks in advance.
Update: added similar image
You can't recover the space in the header but you can not use it in the first place and let the text box grow when necessary. The bad part is that when it is exported to Excel, all the text will be in one cell.
Since your text is different sizes, you'll need to use HTML formatting.
In your regular header, add the page formula you are using with the TRUE part containing the text needed for your additional info and the FALSE part with an empty string - "". Use the <br> tag for a page break and the <font> tag to set the size.
="<b>This is My Page Header</b>" & IIF(Globals!PageNumber > 1, "<br><font size = '2'>Text Box 1" & "<br>" & "TextBox 2" & "<font>", "")
You'll need to set the Placeholder properties to Interpret HTML tags.
I want remove header and footer from specific pages e.g from 2nd 3rd page out of 5 pages because when we export it to excel sheet it will merge cells and the sorting of excel will not work on sheet 2nd and 3rd.
I don't believe there is a way to remove the header/footer region from certain pages of the report. The only options SSRS gives is Print on First Page/ Print on Last Page options in the Header properties, so you can only control the first or last page of the report with those options.
You can hide the elements inside of the header/footer regions through their visibility property. For example, you could hide the header/footer contents on pages 2 & 3 by setting the visibility function to the following for the items inside the header/footer regions:
=Switch(Globals!PageNumber < 2,false,Globals!PageNumber < 4, true, Globals!PageNumber >=4, false)
By hiding the contents in those regions, excel will have a very narrow empty row at the top of the page, but at least it won't create the funky merged cells.
If you want to completely eliminate headers when exporting to excel, you can do so by following the instructions in this article I wrote:
http://jaysonseaverbi.blogspot.com/2013/11/ssrs-exporting-options-for-excel.html
Jaysonseaver gives a good option. But, similarly, you could also do this by the Page Name. If you name your pages (such as for excel export the page name becomes the worksheet name), then the Page Name built in could also be quite useful.
Something like:
=IIF(Globals!PageName = "MyPageName", true, false)
I have a Report in SSRS that displays some logos at the top of the first page. I just got a requirement to add the possibility to also show the logos in the second page -- The report is only two pages. Is there a way to repeat the same Image objects in the second page?
If your report is specifically laid out to span multiple pages, you can use a repeating page header. If not (i.e., the second page is caused by content overflow), and you know it will always be two pages or less, you can use a page header and select "print on first page" and "print on last page" in report properties. Otherwise, if you have tablix controls causing the page span, and your page design allows, you can put the logos in the tablix header and enable repeat header on all pages for the tablix. If none of those work, you'll be stuck, as far as I know.
See also this question.
If you are showing Image in the header then you need to following things:
Adding a Data-Bound Image to a Header or Footer
You can use image data stored in a database in a header or footer. However, you cannot reference database fields from the Image report item directly. Instead, you must add a text box in the body of the report and then set the text box to the data field that contains the image (note that the value must be base64 encoded). You can hide the text box in the body of the report to avoid showing the base64-encoded image. Then, you can reference the value of the hidden text box from the Image report item in the page header or footer.
For example, suppose you have a report that consists of product information pages. In the header of each page, you want to display a photograph of the product. To print a stored image in the report header, define a hidden text box named TXT_Photo in the body of the report that retrieves the image from the database and use an expression to give it a value:
=Convert.ToBase64String(Fields!Photo.Value)
In the header, add an Image report item which uses the TXT_Photo text box, decoded to show the image:
=Convert.FromBase64String(ReportItems!TXT_Photo.Value)
http://technet.microsoft.com/en-us/library/dd220421(v=sql.105).aspx
TO repeat image on every page
IN addition to this, to repeat this image into everyt page, Go to property of TXT_Photo textbox In General tab, tick the check box "Repeat report item with data region on every page" and select your region.
Thanks
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.
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.