Search code examples
reporting-servicesssrs-2008ssrs-2008-r2ssrs-2012reportingservices-2005

Multiple OR statements in SSRS expression


How can I have multiple OR statements in an SSRS expression? Seems to be giving me an error.

Here is what I have now: =IIF((Fields!PART.Value LIKE '*A2*') or (Fields!PART.Value LIKE '*A3*') or (Fields!PART.Value LIKE '*A4*') or (Fields!PART.Value LIKE '*B2*') or (Fields!PART.Value LIKE '*B3*') or (Fields!PART.Value LIKE '*B4*') or (Fields!PART.Value LIKE '*C2*') or (Fields!PART.Value LIKE '*C3*') or (Fields!PART.Value LIKE '*C4*') or (Fields!PART.Value LIKE '*D2*') or (Fields!PART.Value LIKE '*D3*') or (Fields!PART.Value LIKE '*D4*'), "TOP", "")


Solution

  • In SSRS use double quote for strings.

    Try:

     =IIF((Fields!PART.Value LIKE "*A2*") or (Fields!PART.Value LIKE "*A3*")
    or (Fields!PART.Value LIKE "*A4*") or (Fields!PART.Value LIKE "*B2*")
    or (Fields!PART.Value LIKE "*B3*") or (Fields!PART.Value LIKE "*B4*")
    or (Fields!PART.Value LIKE "*C2*") or (Fields!PART.Value LIKE "*C3*")
    or (Fields!PART.Value LIKE "*C4*") or (Fields!PART.Value LIKE "*D2*")
    or (Fields!PART.Value LIKE "*D3*") or (Fields!PART.Value LIKE "*D4*"), "TOP", "")
    

    Let me know if this helps.