Reputation: 35
I have a textbox that is outside a table using SSRS 2008. I'm trying to determine if any of the rows contain 2,3, or 4 using the code below. This works but only for the first row.
Is there a way to make this evaluate all the fields and not just the first row?
Thanks in advnace.
=IIf(
(
Fields!Type.Value = "2"
Or Fields!Type.Value = "3"
Or Fields!Type.Value = "4"
)
, "Yes, found it.", "No, it's missing"
)
Upvotes: 2
Views: 7175
Reputation: 2065
Use the following expression:
IIF(SUM(IIF(Fields!Type.Value = "2" OR Fields!Type.Value = "3" OR Fields!Type.Value = "4",1,0),"DataSet1")>0,"Yes, found it.", "No, it's missing")
Where DataSet1 is the name of your Dataset
What this does is it counts how many times it finds either the value 2, 3 or 4. If the count is more than 0 then the value exists so it will show "Yes I found it"
Upvotes: 0
Reputation: 5114
It will not work, unless you define the scope/dataset, which IIf
does not support.
You can solve this by:
Code
That will update your external textbox (Right click on the report > Report properties > Code tab
)These are the only solutions I can think of.
UPDATE I just thought of a solution that my be of help.
=IIf(
Sum(
IIf(Fields!Type.Value=2, 1, 0),
"YourDataSet"
) = 0,
"Not Found",
"found " & Fields!Type.Value
)
Not sure this applies to your scope, but it's another solution.
Upvotes: 2