Error: Bind variable :1 not set

Hi,

I'm running into an issue when using multiselect boxes.

For example, suppose my query is like that:

select *
from TABLE A
where A in ({{multiselect4.value}})
and B in ({{multiselect5.value}})

I will come across the error: Bind Variable:1 not set.

However, if I take away one condition (any condition), the query will run fine.

I am using Snowflake, and I've used all kinds of functions. They will all work on one condition only, not on two or more. Likewise, this error pops up when I'm using 'union all' to merge two queries using multiselectors.

Anybody has any idea what went wrong? This looks increasingly like a bug.

Any help, pls?

Hi @rile06 I'll try to get some help from the team on this for you, and confirm whether or not it is a bug. Hang tight, thanks!

Hi there @rile06

When you're hovering over the ({{multiselect4.value}}) or ({{multiselect5.value}}), what do you see? Are they green or red? May you share a screenshot of this query of yours? If you're uncomfortable doing that please chime into our chat support and we can help you there as well.

Also, please feel free to share screenshots of your multi-select components themselves being used here in your query.

Best

Pawan

Hi I met the same problem! Has it been solved?

Hi @JeremyLiuNBCU! Are you still running into this issue?

Can you try this syntax:

select * from PUBLIC.PATIENTS where 
 ARRAY_CONTAINS(First_name::variant, SPLIT({{multiselect1.value.join( )}}, ',') ) AND  ARRAY_CONTAINS(Last_name::variant, SPLIT({{multiselect2.value.join( )}}, ',') ) 

@Tess
I am seeing the exact same issue and it has nothing to do with multiselect.

If I try to union two selection statements with conditions using binded variables in Snowflake, I get the error "Bind variable :1 not set."

Example query:
SELECT * FROM TABLE1 WHERE X={{blah}}
UNION ALL
SELECT * FROM TABLE2 WHERE Y={{blah}}

Hi @JonTheSeafarer thanks for checking in! I believe this is a bug. If it's the bug I suspect, we shipped a fix on Retool v2.103.13.

What version of Retool are you using?

Should be using latest version at the time since I am not using the self-hosted version of Retool. I see now it is Retool V2.111.0.

Hi @JonTheSeafarer

Got it! The bug should be fixed on the non-self hosted version of Retool. Here's a similar query with dummy data that's working in my non-self hosted instance:

Does each of your select statements work on it's own i.e querying SELECT * FROM TABLE1 WHERE X={{blah}} and then separately querying SELECT * from TABLE2 WHERE Y={{blah}} ?

Can you also confirm that your resource does not have this setting checked on in the resource setup page?

I am seeing a similar issue. I am attempting to bind to the "inputValue" of a select (the typeahead value). In the query editor, the string seems to correctly bind:

However, if I look at the logs, the query sent looks like:

with the ":1" instead of the text. Is this also a bug or am I binding wrong?

Hi @Andy_Trinity this syntax should generally be working :thinking:

Here's what I'd try next:

  1. Can we confirm if it works if you hardcode the value instead of using {{contactsSelect.inputValue}}?

  2. Can we try it without the extra quotes around {{contactsSelect.inputValue}}?

  3. Can you let us know what the resource type is (Postgres, mysql, etc)?

  4. Can you let us know what version of Retool you're on? You can find the version by clicking the ? button in the bottom right corner of your app editor:
    image