Ignition Perspective Named Query with WHERE IN Clause

Hello, I need to create a Named Query using WHERE IN a multiple selection on a form. Can this be done?

Thanks in advance

You’ll have to use a parameter of type “QueryString” and supply the properly formatted segment of the query in a string. Instead of using the colon prefix to the parameter, use curly braces around the parameter name.

Thank you for your quick response. I saw an example.of that earlier, but when I tried it I was unable to get it to work. When I made my 2nd parameter a query string I got the yellow triangle. Then when I tried to execute the query I got an error message. Do you have a good example you can send me? I will try again.
Maybe, I just missed something.

Thanks.

Have you looked at the manual?

1 Like

If you turn the logger for GatewayNamedQueryManager to debug, you can see how the gateway constructed the query it’s trying to run. That may help you figure out what you’re doing wrong.

1 Like

Thank you both. I just got it working. I used QueryString and then used:

WHERE CAST(Date AS DATE) = CAST( :DateSelected AS DATE) AND Department in ({DeptSelected})

I then had to go to the View and convert my dropdown list where I have multiple items selected to a global session value as ‘1’,‘2’,3’ for example.

Thanks!!

David