Need to show DateParameter in PageHeader

  • I have a report with two date parms (datebegin, dateend) and need to include the DateBegin field as part of the report title. I also have a ReportDate field which I'd like to use. See example below:

    =Globals!ReportName & @DateBegin

    =Globals!ReportName & =First(Fields!ReportDate.Value).

    <-- I get a compilation error msg

    Unfortunately this is not working.

    any ideas.

    thx,

    john

  • Here's an item from another forum that may help:

    Data Fields in Page Header - a Solution From Bill Miller

    Here is an approach I am using to put data items in the page header.

    As you know, Reporting Services does not allow data fields in page headers

    and footers. A straight forward workaround is to put a hidden data field in

    the detail section of the report, and then reference it in the page header.

    For example, a hidden textbox in the detail section named "StateName" might

    have a value of

    =Fields!StateName.Value

    Then a textbox in the page header can have the value

    =ReportItems.StateName.Value.

    However, sometimes this approach does not work. In my case, I had a report

    with a large report footer which was often on a page by itself. The page

    heading still needed to occur on this page; however, since there were no

    detail items on the page, "=ReportItems.StateName.Value" produced nothing.

    To address this, I put the hidden data fields at the beginning of the report

    body so they are available to the first page header. Then Visual Basic

    routines save the values from the page header so they are available for

    subsequent pages. Below is a sample. I'm using Reporting Services 2000 and

    Visual Studio 2003.

    Hidden field:

    =Fields!BillingName.Value in "BillingName"

    Page Header:

    =code.GetBillingName(ReportItems!BillingName.Value,Globals.PageNumber)

    Visual Basic in Report Properties Code:

    '-- Function: GetBillingName

    '-- Written: Bill Miller January 2006 CRI Advantage

    '-- Input:

    '-- BillingName

    '-- Output:

    '-- BillingName

    '-- Purpose:

    '-- Provide BillingName for the report header

    '-- Method:

    '-- Save BillingName in a static local variable when called on the first

    page of the report

    '-- for later page headers, the input variable will be empty

    '-- so return the saved value

    '-- Note:

    '-- The ReportItems passed in must be at the top of the Body of the

    report

    '-- so they will be accessible on the first page of the report

    '-- The function must be Shared for the Static variable to work

    '-- The Static variable will retain its value while the report viewer is

    open,

    '-- even if the parameter values are modified and the report re-run

    public shared function GetBillingName (byval BillingName as string, ByVal

    PageNumber as Integer) as string

    static SavedValue as string

    if PageNumber = 1 then

    SavedValue = BillingName

    end if

    if BillingName = "" then

    return SavedValue

    else

    return BillingName

    end if

    end function

    [font="Comic Sans MS"]toolman[/font]
    [font="Arial Narrow"]Numbers 6:24-26[/font]

  • John,

    toolmans solution is really useful for putting field data in to a header and something I will be using. However you can add the 'value' form of a parameter into a report by inserting a textbox and selecting the relevant parameter:

    ="Business Services Report (" & format(Parameters!DATE.Value, "dd-MMM-yyyy)")

    Gives me

    Business Services Report (24-Apr-2008)

    I'm currently using this in a report and works fine.

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply