Question

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"

)
Was it helpful?

Solution

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.

OTHER TIPS

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"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top