Dynamic report header based on condition

  • I have a requirement to show the company name in the report header based on the login user id. User id and his corresponding comapny name is stored in a database(Table). How to achieve this?. Any help is greatly appreciated.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • Sounds like you need a dataset that returns the company name with a parameter for user id.

  • I placed the text box in the page header and added the following expression

    =First(Fields!companyname.Value, "DataSet_ServiceCenterComapnyName")

    But I'm getting the following error

    An error occured during local report processing

    The expression for the textbox 'companyname' refers to a field.Fields cannot be used in page header or footer

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • Hi,

    It is not possible to access Fields values in Report Header and Footer,follow this approach:

    1.Fetch company Name by user id from Database.

    2.Put a Text Box in the Body area of report (TextBox Name: CompayName)

    3.Put your expression in the Text Box

    i.e (Fields!companyname.Value, "DataSet_ServiceCenterComapnyName")

    4.Set the TextBox as hidden.

    5.In header put ReportItems!CompanyName.Value

    After the 5th step you will get the company name in the Header.

    Do let me know if any thing is unclear.

    Thanks,

    Richa

  • Thanks for your response Richa

    But i'm getting the CompanyName in page header only in the first page not in all the page of the header.

    Please help me to solve this issue. I need report header(CompanyName) in all the page of the report.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • Ya.. i solved this in the below manner

    I created a parameter(Report_Parameter_1) and get the default value as CompanyName from dataset

    I kept a text box in the page header and added the following code

    =Parameters!Report_Parameter_1.Value

    Now it is dispalying the CompanyName in report header for all the pages.

    But good effort Richa.Thanks for your reply

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • I get around this problem by putting a couple of rows at the top of my report table to hold my "header" variables or expressions. I put them above the column headers and the values print on each page. I put a first() around the data item so I only get one value.

  • richa.gupta (3/30/2009)


    Hi,

    It is not possible to access Fields values in Report Header and Footer,follow this approach:

    1.Fetch company Name by user id from Database.

    2.Put a Text Box in the Body area of report (TextBox Name: CompayName)

    3.Put your expression in the Text Box

    i.e (Fields!companyname.Value, "DataSet_ServiceCenterComapnyName")

    4.Set the TextBox as hidden.

    5.In header put ReportItems!CompanyName.Value

    After the 5th step you will get the company name in the Header.

    Do let me know if any thing is unclear.

    Thanks,

    Richa

    Hi Richa,

    I can't get the report to run using ReportItems!COMMODITY.Value. It will work with Fields!COMMODITY.Value but won't change value on commodity breaks.

    Is there a way to do this with dynamic header data? For example, I am processing 2 crop years (2009 and 2010) with 2 commodities (grapes, dried fruit). Each crop year has grapes and dried fruit. I want the header data to change when crop year and/or the commodity changes.

    Thank you,

    Jerri

  • I got it to work. I was trying to put the reportitems in the column headers and when I moved it to the header area it worked.

  • It is entirely possible to do this:

    Create a hidden field in the details record to hold the value you want to see in the header

    Name the textbox "header_field_1"

    populate it with the database value you want to display on the header.

    Next, within the header, reference the report textbox in an expression where you store the value: =ReportItems!header_field_1.value

    note that this is different from referenceing the data value from your dataset.

    HERE IS THE ISSUE THAT I CANNOT FIGURE OUT THOUGH.....

    When the report renders it looks fine... but when you go to print it, the headers become static and only the data from the first row is printed.

    If anyone figures this one out then you have my votes.

  • I am having the exact same issue. I've created a shipping label that has the order number, customer's name, address, and PO in the page header. In the tablix, I have the item details that often require a second page to show all the items on the pallet. I can get the dynamic properties to display in the page header by placing a textbox in the tablix header and assign an expression of something like =First(ReportItems!tboxDocNo.Value) in the header control but it only displays on the first page. Is there a way to display these values on subsequent pages?

Viewing 11 posts - 1 through 10 (of 10 total)

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