We cannot do this with a regular SQL parameter '?'.
A workaround is to replace this '?' by a default value in the query, and dynamically inject an appropriate comma-separated list of values in the "beforeOpen" script of the dataset:
Default query
Assuming the datatype of ID is an integer, set up the query like this (of course use here a valid ID to be able to preview data):
select * from table where ID in ( 1000 )
"beforeOpen" script of the dataset:
this.queryText=this.queryText.replaceAll('1000',params["parameter_name"].value.join(","));
This way, if "parameter_name" returns 3 values 1100,1200,1300 the query sent to the database will be:
select * from table where ID in ( 1100,1200,1300)
It is similar if the datatype of ID is a String, we just have to play a little bit with quotes. However with a String type this kind of handling makes SQL Injection attacks possible, we should firstly check if parameter values look like what we expect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…