Applying all values to a parameter in SQL statement

If a parameter allows multiple values and is enabled to use one single value "All" to represent all its values (the way to enable the "All" value is to set Enable the "All" Option to true when creating or editing the parameter), when you use the parameter in an imported SQL, you should embed each IN condition in parenthesis to enable the "All" value to work properly.

For example, there are two parameters: @pCountry and @pID. Suppose that they both can allow multiple values and have enabled the "All" option and you would like to reference them in an imported SQL query, you should embed each IN condition in parenthesis as follows:

select... from ... where ... and ... and (country in @pCountry) and (customerid in @pID)

There is another case in which you should also embed each IN condition in parenthesis when using such parameters for the same purpose: when you create or edit a JReport query via the Query Editor, you choose to modify its SQL statement manually. If the customized statement fails to be parsed by JReport and you would like to save the statement anyway, then it is up to you to guarantee the statement correctness. In this case, you should embed each IN condition in parenthesis.