LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: Paul Traut on July 20, 2017, 04:15:26 PM

Title: SQL query over a list
Post by: Paul Traut on July 20, 2017, 04:15:26 PM
I know that I can run a report with a sql query where i have a LimeReport variable such as
"SELECT * FROM customers WHERE customerID = $V{customerID}"
but is it somehow possible to run a report with a sql query where i have something like
"SELECT * FROM customers WHERE customerID in ($V{customerID_List})"?
I know it works as long as the variable $V{customerID_List} is only one number but if I try it with more comma separated numbers like
$V{customerID_List}=1,3,4 it doesn’t work.
If I type in the numbers directly to the query
"SELECT * FROM customers WHERE customerID in (1,2,4) it works fine.
Title: Re: SQL query over a list
Post by: Arin Alex on July 20, 2017, 08:35:36 PM
The problem is that the limeport uses bindings to pass parameters and as a result of this "SELECT * FROM customers WHERE customerID in ($V{customerID_List})" will be transformed to "SELECT * FROM customers WHERE customerID in (:customerID_List)".