Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS expression reference This textbox

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?

like image 203
Bill Avatar asked Nov 09 '12 16:11

Bill


People also ask

How do I find a textbox in SSRS report?

rdl file in a text editor and Ctrl-F search for the text box name. This will take you to the xml attributes of the textbox, which usually allows you determine which textbox contains the problem. Save this answer.

How do you use expressions in SSRS report?

In Design view, click the text box on the design surface to which you want to add an expression. For a simple expression, type the display text for the expression in the text box. For example, for the dataset field Sales, type [Sales] . For a complex expression, right-click the text box, and select Expression.


2 Answers

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.

like image 185
Ian Yates Avatar answered Oct 21 '22 00:10

Ian Yates


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.

like image 24
DDA Avatar answered Oct 21 '22 02:10

DDA