F francisco cobos Member Licensed User Longtime User Nov 19, 2007 #1 Hello, I'm trying to filter a csv database, but I get an error when the variable "cad" has a % in the string: (cad="something%"), f example: Table1.Filter("cara_pcb LIKE '"&cara& "'AND " &campo & " LIKE '" & cad & "'") This works well if the strings don't contain any "%" or "[]" Is there any other method?
Hello, I'm trying to filter a csv database, but I get an error when the variable "cad" has a % in the string: (cad="something%"), f example: Table1.Filter("cara_pcb LIKE '"&cara& "'AND " &campo & " LIKE '" & cad & "'") This works well if the strings don't contain any "%" or "[]" Is there any other method?
Erel B4X founder Staff member Licensed User Longtime User Nov 19, 2007 #2 You should enclose %, [ and ] characters with []. Example: 'something[%]'
F francisco cobos Member Licensed User Longtime User Nov 19, 2007 #3 Problem with % character Erel said: You should enclose %, [ and ] characters with []. Example: 'something[%]' Click to expand... I've tried this, but I get the same error, if I don't include this character there is no problem ¿? cad="H64 10[%] 100V LDIL10 AVX/NI"
Problem with % character Erel said: You should enclose %, [ and ] characters with []. Example: 'something[%]' Click to expand... I've tried this, but I get the same error, if I don't include this character there is no problem ¿? cad="H64 10[%] 100V LDIL10 AVX/NI"
F francisco cobos Member Licensed User Longtime User Nov 19, 2007 #4 problem with % character francisco cobos said: I've tried this, but I get the same error, if I don't include this character there is no problem ¿? cad="H64 10[%] 100V LDIL10 AVX/NI" Click to expand... I'm sorry Erel, I was worng: I have tried again your solution and now is fine, Thanks! Anyway, is there any solution for not to have to change the data in the data base?
problem with % character francisco cobos said: I've tried this, but I get the same error, if I don't include this character there is no problem ¿? cad="H64 10[%] 100V LDIL10 AVX/NI" Click to expand... I'm sorry Erel, I was worng: I have tried again your solution and now is fine, Thanks! Anyway, is there any solution for not to have to change the data in the data base?
Erel B4X founder Staff member Licensed User Longtime User Nov 19, 2007 #5 There is no need to change the database. To properly search for a string with % (using Like): B4X: Table1.Filter("cara_pcb LIKE '"&cara& "'AND " &campo & " LIKE '" & StrReplace(cad,"%","[%]") & "'")
There is no need to change the database. To properly search for a string with % (using Like): B4X: Table1.Filter("cara_pcb LIKE '"&cara& "'AND " &campo & " LIKE '" & StrReplace(cad,"%","[%]") & "'")