0
votes

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?

1
Can you post some example data as text and the report XML so we can reproduce the report as is?aduguid

1 Answers

0
votes

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.