Multiple value search separated by Comma

Multiple value search separated by Comma

  
Hi All,

I have a search box in my webscreen.The search box accepts a search values(integers).When I enter a sngle search value(Ex:1001), I am able to see the desired result(single record).But I want to search with multiple values with comma separated lets say:1001,1002,then result should return data related to both the search inputs.How can we perform multiple value search?


Thanks,
Prashanth
Hi Prashanth,

You can use the IN Statement in your SQL Query,

SELECT {Table1}.*
FROM {Table1}
WHERE {Table1}.[ID] IN (1001,1002)

But it is important to validate the text first before injecting it to your query.

Hope it helps,
Mark Chua

Mark Chua wrote:
Hi Prashanth,

You can use the IN Statement in your SQL Query,

SELECT {Table1}.*
FROM {Table1}
WHERE {Table1}.[ID] IN (1001,1002)

But it is important to validate the text first before injecting it to your query.

Hope it helps,
Mark Chua
 
 Hi Mark,

I am using Simple Query and I have written lot of joins,where conditions on that simple query.So I don't want to convert this Simple to Advanced Query and I am looking to fit this in Simple Query only.

Thanks,
Prahsnath


 
 Prahsnath,

I think it is not possible using Simple Query, you have to convert it to Advance Query to use the 'IN' SQL Statement. 

Regards,
Mark Chua
Hi Prahsnath,

you might try the following condition: 
     "%,"+{TABLE1}.[ID] +",%" like ","+SearchParameter+","

which evaluates "%,1001,%" like ",1001,1002," for record with id 1001.
and                    "%,1002,%" like ",1001,1002," for record with id 1002.

Regards,

Hans
just convert the simple query to a advanced query.
Easiest done by testing the query and then select the SQL tab, there is the advanced SQL.
Copy and past into an advanced query and you can use the "IN" as mentioned above
Hi,

Just don't forget to put your input parameter with the property "Expland Inline" set to "Yes".