Larry Smithmier
Larry Smithmier

Reputation: 2731

How do I set the background on a SQP Server 2008 R2 SSRS report using a formula

I am developing a report that incorporates a graphical header on only the first page, and I wanted to utilize two different embedded graphics as page backgrounds. My initial (failed) attempt was to:

  1. right click on the page background
  2. choose the Body Properties

    Context Menu for the report body

  3. Add a Fill Background image Formula

    Report Body Properties dialog

    as follows:

    =IIF(Globals!PageNumber > 1, background, first_background)

When I attempted to render the report I received the following error:

error message for using a global variable in the body

Am I just out of luck with this? Any pointers?

Upvotes: 0

Views: 326

Answers (1)

gbn
gbn

Reputation: 432271

Normally for this kind of stuff you'd use indirection. That is you'd have a hidden text box on the report header. This will have Globals!PageNumber

Then you set the background property by referring to the ReportItems!MyHiddenTextBox.Value.

I haven't tried it for background but it's a common thing to do in SSRS to workaround scope/region issues. This example is the reverse: putting a value into a header/footer. And this. It probably works in the other direction :-)

Upvotes: 1

Related Questions