Search code examples
reporting-servicesssrs-2008

ssrs dataset IIF condition not working


I can't figure out the syntax error in this statement,

enter image description here

" & IIF(Parameters!Product_type_name.Value<>"AllType","and product_type_name='" &  Parameters!Product_type_name.Value & "'","") & "

The logic is, if "AllType" is passed into the product_type_name, then we will have a product_type_name filter.

Else, it will just return nothing.

There seems to be something wrong with escape sequences.

enter image description here


Solution

  • That's not how to pass parameters to a SQL statement in SSRS

    eg: y.facility = @Facility will do

    https://technet.microsoft.com/en-us/library/aa337432(v=sql.105).aspx