Optional(FAULT = '1017' [Invalid where clause. Not Existing columns

I have Interest table ->(Name, Description) and I have one row with the (“Squash”, “No description”).
And I wrote this code to retrieve an interest given its name.


 func findInterestByName(name:String)->Interest? {
 
 let whereClause = "Name = \(name)"
 let dataQuery = BackendlessDataQuery()
 dataQuery.whereClause = whereClause
 
 var error: Fault?
 let bc = Backendless.sharedInstance().data.of(Interest.ofClass()).find(dataQuery, fault: &error)
 if error == nil {
 print("Interest have been found: \(bc.data)")
 return bc.data as! Interest
 }
 else {
 print("Server reported an error: \(error)")
 return nil
 }
 }

And when I execute the above code I get the following error


Optional(FAULT = '1017' [Invalid where clause. Not Existing columns: Squash] <Invalid where clause. Not Existing columns: Squash> )

This is the schema for interest table

Got it. I had to replace
let whereClause = “Name = (name)”
with

let whereClause = “Name = ‘(name)’”

I have another question. how can I cast the result to be Interest object…?

You do not need to cast it, it is Interest object right out of the API call.

Got it. Thanks.