none
Report Header in SQL Reporting Services

    Question

  •  

     

    Is there anyway to create a Report Header in SQL Reporting Services?

     

    I am guessing "no", but I have to at least try and ask away.

     

    Okay, I have had reports where on the first page they want a report header, and then on the 2nd and the consequent pages they want a page header.  This is simple, in the Page Header I put the text box(s) for the Report Header in one Rectangle and then the text box(s) for the Page Header in another Rectangle, stack the Rectangles on to of each other, and set the visibility property of the panels accordingly.

     

    I also see on the table control (which I am using on my report), you can set the table header row(s) to either print on every page or only on the first page.

     

    Neither of these options will work for the report I am trying to build based on a Crystal Report.

     

    I have a page header that needs to appear on every page including the first page.  It is about 3/8" tall.  And then there is a requested report header that should only appear on the first page. The report header is about 2" tall.  So if I try my trick I used before, I will have 2" inches of white space on the 2nd and consequent pages.  The Report Header would correctly print on the first page, but the size of the Rectangle (even if the visible property is set to false) will still eat up white space.

     

    Is there anyway around this, or will I need to have the users redesign their report to fit SQL reporting services?

     

    Let me know if you have any ideas.

     

    Thank you,

     

    T.J.

    Wednesday, October 24, 2007 10:38 PM

All replies

  • In the top of the body put everything you want to appear in the first page header.  In the page header section put everything that you want to appear on subsequent pages.  Then set the page header to NOT print on the first page. 

     

     

    Wednesday, October 24, 2007 11:57 PM
  •  

    "In the top of the body put everything you want to appear in the first page header.  In the page header section put everything that you want to appear on subsequent pages.  Then set the page header to NOT print on the first page. "

     

    Thank you for your help.  When I tried your suggestion, I moved my Retangle property into the top of the Body of the report.  I left the expression on the "Hidden" property the same...

     

     

    Code Block

    =IIF(Globals!PageNumber = 1, false, true)

     

     

    (which works correctly in the Page Header, and is needed so that the 5 text boxes inside the Rectangle are hidden on the 2nd page through the end of the report) and I get the error...

     

    "The Hidden Expression for the rectangle "Rectangle1" refers to the Global variable PageNumber or TotalPages.  These Global Variables can used only in the Page Header and Page Footer."

     

    So your idea makes sense, but is prevented by SQL Reporting Services.

     

    Am I doing something wrong?

    Thursday, October 25, 2007 3:18 PM
  •  

    You aren't doing anything wrong per se.  There are limitations one being that globals cannot be referenced from the body.  However, I don't think you need to use the page number on the visibility of the rectangle in my solution.  At least if I understand your issue.  If there is one report header for the entire report then there really is not reason for the conditional visibility.
    Thursday, October 25, 2007 3:52 PM
  •  kcon wrote:

     

    You aren't doing anything wrong per se.  There are limitations one being that globals cannot be referenced from the body.  However, I don't think you need to use the page number on the visibility of the rectangle in my solution.  At least if I understand your issue.  If there is one report header for the entire report then there really is not reason for the conditional visibility.

     

    I don't understand.  Within SQL reporting services you can select to have a Page Header or not.  So in my page header I put a Rectangle tool, and set 5 text boxes inside the Rectangle.  I then set the Rectangle property to only appear on the first page by using the Expresion I posted in my post above.

     

    This works great, my 5 text boxes only appear on the first page.  But every page after the first page, there is a large blank white space (2" tall on a landscape style report) that is left empty, because the rectangle property takes up space even though it is invisible.

     

    I tried setting two rectangles in the header portion of the report, one with the first page header (report header + page header, which is about 2 1/2") and then another with just the page header information (about 1/2").  Again, the text hides correctly on my pages, but I am left with about 2" of white space at the top of the report on pages 2 - end due to the Report Header information rectangle.

     

    I am starting to think there is no way around this, and the users will need to redesign their report specifications.

     

    Thank you for your help.

    Thursday, October 25, 2007 4:36 PM
  • TJ,

     

    The only reason you have a rectangle and a conditional visibility in the header is so the items in that rectangle print only on the first page.  When you take those items out of the rectangle and put them in the top portion of the body they will naturally only print once assuming there are no repeater controls.

     

    RS renders report items in the body sequentially and will only render them once unless it is a repeater control (table, list matrix) that is specifically bound to a mutli-record dataset.  This is not like Crystal where the body is bounded to a dataset.

     

    My guess is that what is in the first page report header are static text and/or report parameters.

     

    By setting the page header to NOT print on the first page it leaves the top of your body section as the first page header. 

    • Proposed as answer by dbrooksTX Friday, October 30, 2009 2:05 PM
    Thursday, October 25, 2007 4:48 PM
  •  kcon wrote:

    TJ,

     

    The only reason you have a rectangle and a conditional visibility in the header is so the items in that rectangle print only on the first page.  When you take those items out of the rectangle and put them in the top portion of the body they will naturally only print once assuming there are no repeater controls.

     

    RS renders report items in the body sequentially and will only render them once unless it is a repeater control (table, list matrix) that is specifically bound to a mutli-record dataset.  This is not like Crystal where the body is bounded to a dataset.

     

    My guess is that what is in the first page report header are static text and/or report parameters.

     

    By setting the page header to NOT print on the first page it leaves the top of your body section as the first page header. 

     

    Ah-ha!!!

     

    I understand what you are saying now.

     

    And I beleive this fixed the issue.

     

    Wow, so easy, yet I over looked this.

     

    Thank you!

    Thursday, October 25, 2007 5:27 PM
  • Hi There

    I have solved the problem with the following code block

    Dim _Page as Integer
    
    Function GetPage as Integer
      _Page = _Page + 1
      GetPage = _Page
    End Function

    Set the image in the Body-section and set the Image / Visibility / Hidden property as Expression with following:
    =IIF(GetPage()=1,False,True)

    THATS IT...


    Jan Borup Coyle
    Friday, October 30, 2009 1:12 PM
  • I followed your technique and it works.  The only thing is on page one.   When printed, it shows my header, the contents not visible which is good.   But just a large amount of white space.   Any way around that other than reducing the header size?
    Wednesday, February 29, 2012 8:25 PM