SSRS expression reference This textbox
Asked Answered
H

3

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?

Hertford answered 9/11, 2012 at 16:34 Comment(1)
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.Discrete
F
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.

Flak answered 5/7, 2013 at 5:50 Comment(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")Floats
C
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.

Cypriot answered 7/2, 2014 at 17:51 Comment(0)
A
0

Me.Value appears to work in 2016 version

Abreaction answered 11/4 at 15:36 Comment(1)
This should be a comment or better, expand your answer, it will be helpful.Elfriedeelfstan

© 2022 - 2024 — McMap. All rights reserved.