I am using the following code to retrieve all replies that belong to specific discussion but I keep getting nil results.
I have reply table that have one-to-one relationship with discussion table.
I have attached screen shots of schemas of both tables.
func getReplysForDiscussionAsync(discussion: Discussion) -> [Reply]?
{
let whereClause = "ReplyDiscussion.objectId = '\(discussion.objectId)'"
let query = BackendlessDataQuery()
query.whereClause = whereClause
let dataStore = backendless.persistenceService.of(Reply.ofClass()) as IDataStore
dataStore.find(query,
response: { (retrievedCollection) -> Void in
print("Successfully retrieved Replys for Discussion")
let replys = retrievedCollection.data as? [Reply];
print("replys = \(replys)")
for reply in replys! {
print("reply = \(reply.ReplyBody)")
}
return replys
})
{ (fault) -> Void in
print("Server reported an error: \(fault)")
}
return nil
}