How can I show data in the header of a multipage SSRS 2005 report? - reporting-services

This question was very helpful, however I have a list control in my report, and when the report grows over 1 page, data in the header only shows up on the last page of the report.
Apparently, hidden textboxes have to be on every page of the report for header to function properly. How do I do that? The only control I have in the list is a textbox with bunch of text that grows way over 1 page.

Although SSRS does not allow us to use DataSet fields in page headers, it allows us to refer to report items. So we could place a textbox (that takes its value from a DataSet field) anywhere in our report's body and set its Hidden property to true.
Then, we could easily refer to that textbox in the page header with an expression like: =ReportItems!TextBox1.Value and we are done. Note that the textbox that is being referred should be present on every page, or otherwise the header will print an empty value.

sExchange website to the rescue!!!
All I needed to do is to use Report Parameters with queried values from my dataset; and then reference =Parameters!Name.Value in the textbox in the header of the report.

Select Report Parameters, Add new parameter and check hidden, allow null and allow blank value.
If you are retrieving the values from database:
Under Available Values:
check "from query" radio button and provide dataset,value field and label fields.
Under Default Values:
check "from query" radio button and provide dataset,value fields.
Now provide the value for text box in the footer/header as =Parameters!Footer.Value (Footer is the parameter name).

the hidden text boxes can be placed within a rectangle that was a repeatwith property set to be your list item.

Related

SSRS Report Builder 2012 - How to hide list based on field value?

I'm using Report Builder 2012 to create a report. I have inserted multiple text boxes and other controls inside a list box so that I can hide all the controls at once just by hiding the list box. I'm using a SQL Server stored procedure to fetch rows of data. I'm using below expression to hide/show the list box.
=iif(Fields!certificateType.Value = "CT", False, True)
It works fine but it only checks the first row of data. If certificateType field is "CT" in the first row of data, it shows the list box but it doesn't hide the list box back for the next row of data in which certificateType is not "CT". It seems like list box visibility only checks the first row of data and applies it for all the other rows as well. How can i check the visibility of list for all the data rows?
Okay, based on our chat I have updated this solution.
I mocked up some data that looks like this:
certificateType
---------------
AT
BT
CT
DT
ZT
I created a quick and dirty report with a list. In that, I added a rectangle with a textbox in it. I set the dataset for the list to the main dataset (DataSet1 in my case). I set the expression for the textbox to this:
=Fields!certificateType.Value
Image in design mode:
I clicked on the list, and in the Row Groups pane, I right-clicked the Details rows, and chose Group Properties. On the General section, I clicked Add to add a new group expression. Then I chose certificateType from the dropdown.
I moved to the Page Break section of the Group Properties dialog and ticked the Between each instance of a group check box. Click OK.
Now, the report will break for each instance of a certificate type that comes in the dataset. So, if you have ten different cert types in the data, you will get one page for each.
You can't see it in my image below, but there are 5 pages now.
Hope this helps!!

SSRS Hiding Text in Footer

On my SSRS report I want to hide a page footer if none of the rows returned meet the condition where I need to show the footnote. I have a list of names and on the report I add an asterisk to indicate a certain condition for that person. For example:
Smith, Sally*
I have a footnote that says something along the lines of:
*Employee needs updated form on file
I am using the Visibility option of the Text Box Property to add an expression to hide the text in the textbox of the page footer if none of the employees have an asterisk after their name. (No sense in showing the footnote if it does not apply to anyone on the report.)
I've seen some examples here and thought this would work (setting false to not hide the text if an asterisk is appended to the name in the dataset):
=IIf(Fields!Name.Value.Contains("*"),False,True)
I don't get a syntax error but the footnote does not show no matter what I do with this expression or similar ones I have tried. I saw one place that said you cannot use a expression to hide the text in a textbox in a page footer but could not confirm this is true.
Is it my syntax or that fact that one cannot hide text in a textbox on a page footer? The option is not grayed out so it seems this should be possible.
This formula doesn't lookup a results set.
It only checks the first row: if the first row contains asterisk you will see footnote.
You can try to solve this for footer such way:
Create report variable "Has asterisk"
Create function at report code:
Public Function CheckAsterisk(ByVal CheckString As String) As String
If CheckString.Contains("*") Then
Report.Variables!HasAsterisk.Value = True
End If
Return CheckString
End Function
Call function from textbox where you display person name:
=Code.CheckAsterisk(Fields!Name.Value)
Check report variable at footer

Use multiple ReportItems in one expression in RDLC Report

I want to display page wise sum of 2 columns in footer.for that I am using following expression in footer
=Sum(ReportItems!col1.Value) + Sum(ReportItems!col2.Value)
but it gives following error
"The Value expression for the textrun refers to more than one report item. An expression in a page header or footer can refer to only one report item."
anybody knows how can I solve this issue and display page wise sum in footer ?
Thanks
Here is simple workaround for your problem:
Add single textbox to the body of the report and name it i.e. "SUM"
Add your expression to this textbox =ReportItems!col1.Value + ReportItems!col2.Value
For this textbox set visibility as hidden
In the footer refer to this hidden textbox using =ReportItems!SUM.Value
I usually use Custom code-feature of report for these operations. Just open Report Properties and choose Code-view. Just then write basic VB get/set-methods to save and sum values.
Referring to methods in TextBox expression goes just like this: =Code.[YourMethodNameHere].
For example, saving value:
=Code.SaveMyValue(Fields!MyVal.Value)
and getting value:
=Code.GetMyValue()

How do I print multiple duplicate "named" copies of a report in SSRS 2008? eg, "ORIGINAL", "CUSTOMER COPY", etc

I want to be able to have a multi-value parameter called CopyTypes, which would contain values such as:
{ "ORIGINAL", "CUSTOMER COPY", "PACKING LIST" }
I would like the report to create an identical page for each value in my parameter array, only changing a single text variable in the page footer for each page.
I had thought of just using a single value parameter and calling the report in code once for each param, but this solution isn't ideal.
Here's a setup that may work for you:
Create a subreport for the "single page" with a fixed height
In the subreport, create a parameter "FooterText"
Display the parameter at the bottom of the page (footers of subreports don't show up)
Create a parent report, with that subreport in a list
Create a dataset that generates a row for each selected value in the parameter
Pass that dataset's values as a parameter to the subreport
See my answer to another question on how you could convert the selected values to a dataset.
Bottom line is that you can't really relate stuff in the header/footer of a report to the content of a page: they're quite "static" in that regard. This is particularly a problem for the footer (and also in my suggestion above), because if you "fake" a footer in the report body it may be "shoved off" the page if the body content grows. If that's a problem it may be worth to consider a workaround, and place the text in the ("fake") header e.g. at the top of the subreport.

Reporting Services - Group Name in Page Header

I have a report with one group (Office Name) which page breaks between each group - so the data for only one Office can appear on a given page. How do I get that Office Name to appear in the page header?
I tried creating a hidden textbox in the details section of the report which has the Office Name value and then referencing that in the Page Header, but I get the last Office Name value on page 1 and then it is blank on every other page.
Today, at last I found another way to do this.
On the group that you specified the page break, in the properties window, expand the Group section.
See Pagination in Reporting Services (Report Builder and SSRS)
You can set the BreakLocation property in the Tablix Properties,
Rectangle Properties, or Group Properties dialog boxes, but you must
set the Disabled, ResetPageNumber, and PageName properties in the
Report Builder Properties pane.
You should see a PageName field. This field can be set to that of one of the field data values from the dataset used by the tablix.
Once you have set the PageName field, you can add a textbox to the Page Header/Footer and set the expression to use the PageName field. Built-in Globals and Users References (Report Builder and SSRS)
=Globals!PageName
This should then change on each group change, and be visible on each page.
I have realy struggled finding a good solution for this, so if I need to clear up the answer, please feel free to suggest this.
I got it to work and I'll post the answer in case someone else runs across this issue.
For some reason referencing the text box did not work, but when I put a hidden column in the table with the same value, I could then reference that in the Page Header.
I am actually doing this in the footer and it worked! Thanks! Just wanted to add if you have multiple values you are trying to display in the header or footer, you can string them together with a delimiter in the pagename expression like
=Fields!FIELD1.Value + "|" + Fields!FIELD2.Value + "|" + Fields!FIELD3.Value + "|" + Fields!FIELD4.Value
Then you can create new fields (one for each value) and parse out each field like
=(Split(Globals!PageName, "|")).GetValue(0)
=(Split(Globals!PageName, "|")).GetValue(1)
=(Split(Globals!PageName, "|")).GetValue(2)
=(Split(Globals!PageName, "|")).GetValue(3)