Can't filter SQL result by array - Snowflake

I have this code:

    "Fiscal Month", 
    "Fiscal Month#", 
    SUM("Transaction Revenue") AS "Revenue", 
    SUM("Sessions") AS "Sessions"
    "Fiscal Month" > '2023-01-01' 
    AND "Fiscal Month#" = {{month1.value}} 
    AND "Subchannel" IN ({{ => `'${item}'`).join(",")}})
    "Fiscal Month", 
    "Fiscal Month#", 

And prior to this I kept getting an error saying Variant isn't an accepted type. I'm using a multiselectListBox to get an array of values and I'm trying to filter my SQL code using that array.

Any suggestions?

Try = ANY() instead of IN
And I don't think you need to use map as you should be able to use multiselectListBox1.value as it is already an array

Hey @Steven_Shoemaker! Using arrays in snowflake can be a bit tricky in Retool. We have a post here that goes into some of the different SQL syntax for arrays.

For your query, this syntax should work:

Using the values from this multiSelect:

Let me know if you have any questions!

1 Like