I want to retrieve users whose name property is similar to a search text (i.e. a user searching for other users by name).
let whereClause = "name LIKE '\(name)'"
Here’s all of my code for the query
The problem is it only gives me an object when the text matches the name exactly. I would like it to return results even if there is a partial match of the text.
For example it would be great if I could retrieve all users whose name contains any of the text that I am searching for (rather than only users whose names match the search text exactly).
my understanding is that shouldn’t return anything at all.
I am trying to figure out how to set up my where scheme to return words that contain or start with my search term. However, I am not being able to filter my results with POStman
this setup works when encoded
where%20data%20LIKE ‘%cr’ returns ‘crap’
where%20data%20LIKE '%rc’ does not return ‘crap’
You can see examples of using LIKE in a where clause in the following section of the documentation:
I do not know exactly what transformations postman does with parameters when it comes to encoding. Personally, I find our own REST Console which is built into Backendless Console more convenient when composing a Backendless API request. You can find REST Console when you navigate to the Data section, select a table and then click the REST Console tab.
I realize the error that I was making this morning. In my like clause I was including double quotes around the query item. Instead, what worked was were single quote
data LiKE ‘%cr’
Instead of
data LIKE “%cr”
And to answer your question. That was my first MySQL query I’ve constructed. Now I know better!
Thank you. Is there a note in the docs to specifically use single quotes? I’m sorry, I must’ve missed that. I was going off the docs but missed that specification.
Anyway, all is working now when Url encoding and using single quotes. Thank you!
there is no such note (although there are a lot of examples of using SQL queries on our docs and you can see the syntax there).
This is the standard syntax of SQL queries.