How to refer to the value of a textbox in an expression window (Local Report)?

Hopeless picture Hopeless · May 3, 2013 · Viewed 14.2k times · Source

The expression window doesn't need to be the expression window you can open by right-clicking the textbox -> choosing Expression. A textbox has some expression windows which are Font-related expression windows, Alignment-related expression windows, Visibility-related expression window,Border-related expression windows and the Value-related expression window.

In the Value-related expression window, I don't need to refer to the value of the current textbox, because it's exactly the value Expression used for the textbox. However I wonder if there is a way to refer to this value in other expression windows of a textbox? Or simply use the exact value expression of the textbox?

For example, the value expression of a textbox is =Fields!ID.Value, in another expression window (e.g the Color expression window), I want to refer to this value by some keyword if possible like this =IIF(this.Value > 0, "Green", "Red"). Currently I have to use the exact expression of the textbox and the expression for its color looks like this =IIF(Fields!ID.Value > 0, "Green", "Red").

I hope there is a simple way to refer the value of the current textbox, not through its exact expression, because sometimes the expression is too long to re-type it or even copying-n-pasting the expression is not better than a short keyword.

Thanks!

Answer

prabhuK2k picture prabhuK2k · Sep 3, 2013
=IIF(ReportItems!ID.Value > 0, "Green", "Red")

Before that you have to Name your TextBox as ID