SSRS Switch with an Or?

  • Going back to the IIF approach, could you not do something like:

    =IIf(Parameter!ProviderID.Value = 1, 'A,B', 
    IIf(Parameter!ProviderID.Value = 2, 'B,C',
    IIf(Parameter!ProviderID.Value = 3, 'B,D', 'NOVALUE')))

    Checks if the value is 1, if not, then check if it is 2, if not then check if it is 3, if not, then display NOVALUE?  I don't have an environment to test it, but I can't see why that wouldn't work...

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • That one didn't work either, but the "IN" operator in the table filter jogged my memory on something I had to do before with Split.  I tried this and it seems to have worked:

    =IIF(Parameters!ProviderID.Value = 1, CStr("REG1,SYS").Split(","), 
    IIF(Parameters!ProviderID.Value = 4,CStr("REG4,SYS").Split(","),
    IIF(Parameters!ProviderID.Value = 5,CStr("REG5,SYS").Split(","),
    IIF(Parameters!ProviderID.Value = 6,CStr("REG6,SYS").Split(","),

    Thanks to you all for your input on this!  Don't know why I didn't think of nested IIFs but glad we got it covered.

    Thanks again!

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply