ah that's because you are checking for matches after splitting on all different placements of a comma but none of them check after splitting on a space.
try changing
from table1
where table1.data = ANY ({{textInput1.value.split(' ,')}}) OR table1.data = ANY ({{textInput1.value.split(', ')}}) OR table1.data LIKE {{'%'+textInput1.value.split(',')+'%'}} OR table1.data LIKE {{textInput1.value}} OR table1.data = ANY ({{textInput1.value.split(',')}})AND {{textInput1.value}} <> ''
to
from table1
where table1.data = ANY ({{textInput1.value.split(' ')}}) OR table1.data = ANY ({{textInput1.value.split(' ,')}}) OR table1.data = ANY ({{textInput1.value.split(', ')}}) OR table1.data LIKE {{'%'+textInput1.value.split(',')+'%'}} OR table1.data LIKE {{textInput1.value}} OR table1.data = ANY ({{textInput1.value.split(',')}})AND {{textInput1.value}} <> ''
I don't know how much it'll help, but now it will take 22nd Street
and split it into 22nd
and street
then check each one. with the original one it would split 22nd Street
into undefined
, as it wasn't found, which will require the table to have that in it and since it doesn't (and can't?) it failed.
for reference, if it saw something like Melo, Priyanka 22nd Street
w the change I added these are the splits that you will be comparing to the table defined in that PS query. these are in order:
- ANY .split(' ')
'Melo,'
'Priyanka'
'22nd'
'Street'
- ANY .split(' ,')
- ANY .split(', ')
'Melo'
'Priyanka 22nd Street'
- LIKE .split(',')
'Melo'
' Priyanka 22nd Street'
- LIKE %Melo, Priyanka 22nd Street%
- (0+ spaces)
'Melo, Priyanka 22nd Street'
'Melo, Priyanka 22nd Street'
(0+ spaces)
- ANY .split(',') AND .value IS NOT ''
'Melo'
AND .value IS NOT ''
' Priyanka 22nd Street'
AND .value IS NOT ''
do note the extra spaces and commas that are included from the splits.
you can also try:
from table1
where table1.data = ANY ({{textInput1.value.split(/\s*(?:,|\s|$)\s*/)}}) OR table1.data LIKE {{textInput1.value.split(' ')}} OR table1.data = LIKE ({{textInput1.value.split(/\s*(?:,|\s|$)\s*/)}})AND {{textInput1.value}} <> ''
this one uses a regular expression. it looks for zero or more spaces, followed by a comma, followed by zero or more spaces—and, when found, removes the spaces and the comma (with split).
I think I got that right, maybe someone good with regex will chime in if not, otherwise so you can read it and make changes where you need to:
/
regex delimiter
\s
white space
*
match '\s' 0+ times
(?:
start capture group
,
literal comma
|
or
\s
white space
|
or
$
end of string
)
end capture group
\s
white space
*
match '\s' 0+ times
/
regex delimiter