Reputation: 93
When building an SSRS report, I have an expression set for one of the tablix fields like this:
=IIF(IsNothing(MyField.Value)=0,MyField.Value,"fubar")
So if there is not value in the cell, "fubar" is instead displayed in the cell as a placeholder.
My question: Is there a way to evaluate this placeholder value in a formula?
For example, I want to color all cells that contain "fubar". I can't use MyField.Value because "fubar" is not a value in my dataset, it's just a placeholder. Is there some attribute like MyField.Placeholder or something that looks at these superficial cells values instead of the actual dataset value?
Upvotes: 0
Views: 1890
Reputation: 14108
You can use the name property of the textbox to refer to the cell.
Suppose I have the following expression similar to yours:
=IIF(Isnothing(Fields!Thing.Value),"Foo Bar", Fields!Thing.Value)
It will put Foo Bar
in the cell where Thing
field is null.
If I want to color the background color of that cell I can reference it using ReportItems collection.
=IIF(ReportItems!Textbox86.Value="Foo Bar","Red","Transparent")
Note Textbox86 is the cell where I used the first expression it will contain the hardcoded value Foo Bar when the Thing value is null.
To see the Textbox name of the cell select it, right click on it and go to Textbox properties you will see Textbox#.
Let me know if this helps.
Upvotes: 1
Reputation: 1618
Either ReportItems!MyTextbox.Value
or Me.Value
should give you what you need. So to control the background colour, you could use:
=IIF(ReportItems!MyTextbox.Value = "fubar", "Pink", "White")
https://msdn.microsoft.com/en-us/library/dd255285(v=sql.105).aspx
Upvotes: 1