Hi there,
Im trying to query a table based off a Boolean value, but cant seem to get it right…
This is my class…
class ContextualType : NSObject {
var title: String?
var topic: Topic?
var id: Int = 0
var apiKey: String?
var source: String?
var active: Bool = false
}
and this is my code…
func getAllActiveContextTypes(completionHandler: (success: Bool, data: AnyObject?) -> ()) {
let dataQuery = BackendlessDataQuery()
let whereClause = "active = true"
dataQuery.whereClause = whereClause
backendless.data.of(ContextualType.ofClass()).find(dataQuery, response: { (result: BackendlessCollection!) -> Void in
var contextualTypeList = [ContextualType]()
if result.getCurrentPage().count > 0 {
let contextTypeResults = result.getCurrentPage()
print("*** Found \(contextTypeResults.count) ContextualType objects")
for contextType in contextTypeResults {
let contextTypeObject = contextType as! ContextualType
contextualTypeList.append(contextTypeObject)
}
} else {
print("No Active ContextualType objects found in database..")
}
completionHandler(success: true, data: contextualTypeList)
},error: { (fault: Fault!) -> Void in
print("Server reported an error: \(fault)")
completionHandler(success: false, data: nil)
})
}
I keep on getting no results, even though I have a Boolean column in my table called ‘active’ with at least one item with a ‘True’ value.
Am I using the Boolean where clause wrong? Docs dont seem to give any examples. Thanks!