how to access global parameter in report body!

  • hi folks,

    i have a requirement through which i need to show the pages total. and for that i want to access global parameter page number, how to achieve it.

    i have tried few things in google but not working

    some of them are

    1. in the expression i have used ="Page " + Globals!PageNumber.ToString() + " of " + Globals!TotalPages.ToString()

    2. http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/243e6b82-70f5-4051-8b3f-4110f931591f/

    but no success, please help me to achieve this.

    thanks

  • ToString() is not a valid method for the variables, if you want to convert it to a string use CStr

    =CStr(Globals!PageNumber)

  • Thanks for your reply, by using this also i am not getting the desired result its throwing error.

    i used this

    ="Page " + CStr(Globals!PageNumber) + " of " + CStr(Globals!TotalPages)

    it is saying that we can't use global variables with report body as it can be use in report header or footer only.

    is there any way to use it in report body ??

    Error2[rsPageNumberInBody] The Value expression for the textrun ‘Textbox228.Paragraphs[0].TextRuns[0]’ refers to the global variable PageNumber or TotalPages. These global variables can be used only in the page header and page footer.D:\WORK\UAT\ReportXL\RiverbedReportsUpdated\RiverbedReports\RiverbedReports\QuoteReport_Dev.rdl00

  • Either add a report header or footer, or create user parameters and assign them the values as an expression, I have personally not done the user params so cannot confirm if they will work.

  • Build In variables like Page Number and Total Pages does not work in Report Body, as they are property of Page Footer and Header.

    One more reason because the body of the report is executed first then the page footer or header.

Viewing 5 posts - 1 through 4 (of 4 total)

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