Vian Ojeda Garcia
Vian Ojeda Garcia

Reputation: 867

SSRS how to have two different condition in Action Property

I am working in a SSRS that needs to link a report based on the value in a textbox.

I have tried:

=IIf(Fields!Factors.Value = "Touched Leads","SCPL",Nothing)

Which works fine, but when I try to add another condition like this:

=IIf(Fields!Factors.Value = "Touched Leads","SCPL",Nothing) OR 
    IIf(Fields!Factors.Value = "TOTAL","Disposition",Nothing)

Then it does not link any report. How do I do this right?

Upvotes: 0

Views: 369

Answers (2)

R. Richards
R. Richards

Reputation: 25151

I think that the expression you need will look like this:

=IIf(Fields!Factors.Value = "Touched Leads","SCPL", 
    IIf(Fields!Factors.Value = "TOTAL","Disposition",Nothing))

This checks the first condition ("Touched Leads"), if that is true, link the SCPL report, otherwise check the "TOTAL" condition. If that one is false, return Nothing.

Upvotes: 0

mhep
mhep

Reputation: 2139

What you are trying does not work correctly as the IIF statements are not nested and what it is doing is:

IIF(this, true part, false part) OR IIF(this, true part, false part)

So when Fields!Factors.Value = "Touched Leads" the expression evalutes to SCPL OR Nothing which isn't valid.

Alternatively you could use SWITCH which has a nicer syntax, the final True statement is your catch all

=SWITCH(
    Fields!Factors.Value = "Touched Leads", "SCPL",
    Fields!Factors.Value = "TOTAL", "Disposition",
    True, Nothing
)

Upvotes: 2

Related Questions