Multple values from textinput to be used in T-SQL where clause

  1. My goal: Type comma‑separated values into a Retool input and pass them into a SQL WHERE clause.
  2. Issue: Not working with multiple values but work with one
  3. Steps I've taken to troubleshoot: Used variables and SPLIT_STRING methods - {{
    (textInput1.value || '')
    .split(',')
    .map(s => s.trim())
    .filter(Boolean)
    // Escape internal single quotes by doubling them:
    .map(s => '${s.replace(/'/g, "''")}')
    .join(', ')
    }}
  4. Additional info: (Cloud or Self-hosted, Screenshots)

I would generally use a multiselect where you allow for custom values as I think its cleaner and more intuitive for the end user; however, you should be able to accomplish this with your current build with

WHERE 
({{ textInput1.value !== ‘‘ }} OR
f.C4C_Ticket = ANY({{ textInput1.value.split(',') }} )
2 Likes

Thank you David for the suggestion, it worked. In addition to that I missed to notice that some values had characters and/or letters in them and when removed all was functioning as expected.

No problem! happy to help