I noticed a multi select option on the dropdown. Very nice, expect I’m a dummy and don’t understand how to capture the selected values. I’m assuming we will need to use a transform for this?
Would like to revisit this, what would be the best way to utilize multi select and a query? Normally I will just use a simple WHERE clause and the ID from the dropdown. With multi select I could have several. Any tips would be greatly appreciated.
Nevermind, didn’t realize you could do something like this:
query= 'SELECT name FROM students WHERE id IN (%s)' % placeholders
Well, I spoke too soon. I can get the query to work in SQL (SSMS), but not using named query. In SQL, both of these work,
WHERE Id IN ('26557','26497','26491') WHERE Id IN (26557,26497,26491)
Id is a BigINT. Is there a trick using named query, or am I stuck generating a string for the query?
The value of a multiselect is an array so it would look like this value = [26557,26497,26491] i’d guess.
Can you look in the log what exactly the query is generating?
you could try do something like: placeholders = str(placeholders).replace(’[’,’’).replace(’]’,’’)
The only way I could get it to work was change the ‘ID’ parameter in the named query from Value to QueryString.
Well, your post showed a string interpolation example, which is basically what a named query’s QueryString parameters are. It is well known that lists of elements can’t be used in proper value substitutions, whether in a named query or via
? substitution in scripted “Prep” queries.