I am developing an SSRS 2008 R2 RDL file. Now, I am trying to add a report parameter which should be a multi-select. Previously I have worked with multi-select parameters
But the line that causes this error is:
AND (@IncidentType is NULL OR event_definition_rv.event_definition_id in (SELECT Names FROM #incident_types))
Since @IncidentType is a multivalued report parameter,
you can't use @IncidentType Is NULL
in your report's Dataset Query because it messes up the sql code and it become unpredictable.
Also "A multi-value parameter cannot include null values" so it's useless to check if the parameter Is Null. You could maybe use a possible workaround like this:
AND ('NULL_FLAG' IN (@IncidentType) OR event_definition_rv.event_definition_id IN (@IncidentType))
See docs.microsoft.com where it says:
- The query must use an IN clause to specify the parameter.
Note:
The report server rewrites queries for data sources that cannot process parameters as an array. Rewriting the query is necessary to produce the intended result. A query rewrite is triggered when a parameter is defined as multivalued and the query uses an IN statement to specify the parameter. If you build a query that does not include the IN statement, be aware that you are circumventing the logic the report server provides to support multivalued parameters.