- My goal: Type comma‑separated values into a Retool input and pass them into a SQL
WHEREclause. - Issue: Not working with multiple values but work with one
- 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(', ')
}} - 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
