7

I have a fairly wide Tablix, and I would like to add similar expressions to each of the textboxes in the row. For example:

TextAlign:
=iif(ReportItems!TextBox1.Value<>0, "Right", "Center")

But I don't want to have edit the formula in each textbox. What I want to say is:

TextAlign:
=iif(Me.Value<>0, "Right", "Center") 
OR
=iif(This.Value<>0, "Right", "Center")

Currently using SSRS for SQL 2008R2 and VS2008. Is there a way to do this, or am I stuck? Will I get this if I upgrade to SQL 2012 and VS2010?

1
  • 2
    The .rdl file is a nicely formatted XML file. You may be able to cut'n'paste to edit that more quickly than using the GUI. But I don't know a way for an object to refer to itself in SSRS.
    – Jamie F
    Commented Nov 9, 2012 at 19:26

3 Answers 3

10

MSDN says Me.Value should work. See http://msdn.microsoft.com/en-us/library/dd255285.aspx

The example given there is

=IIF(Me.Value > 0,"Black","Red") 

Having said that, I have just tried it for SSRS 2008 R2 inside BIDS and it does not work.

"Object reference not set to an instance of an object".

The documentation linked is for 2012 but changing the documentation version to 2008 or 2008 R2 still has the exact same page displaying.

1
  • This was helpful for 2016. For Textbox background color property this expression seems to work (at least in visual studio design preview) =IIF(IsNothing(Me.Value),"LightGrey","Transparent")
    – Sean
    Commented Jul 6, 2023 at 16:58
1

Me.Value used to work fine in the 2005 version of SSRS then there was a bug introduced in the 2008 version.

Robert Bruckner (who wrote a book about SSRS) states it was fixed in the 2008 R2 version but maybe not as it doesn't work for you.

I have tested it in SSRS 2012 and it doesn't work for me.

See this conversation for more details. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/98f0e6a0-108c-44bb-8730-5e90cf1fa5a4/mevalue-bug-in-ssrs-2008

Robert Bruckner suggest you contact Microsoft support directly if you want a fix.

0

Me.Value appears to work in 2016 version

1
  • This should be a comment or better, expand your answer, it will be helpful.
    – sikaili99
    Commented Apr 12 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.