SSRS IIF evaluate all the fields

iifreporting-services

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"

)

Best Answer

It will not work, unless you define the scope/dataset, which IIf does not support. You can solve this by:

  • creating a Code That will update your external textbox (Right click on the report > Report properties > Code tab)
  • Using your expression inside your table.

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.

Related Topic