Hello,
I wish to track changes in a specific column in my database regardless of objectId.
More specifically I want to use the new information that is entered in the database at a certain column with a new objectId.
I am currently using the following code to upload the information to the database and wait for any changes:
func getCards() {
print(“get cards”)
print(gameCode)
dataStore = Backendless.sharedInstance().data.ofTable(gameCode)
testObject = [userName : “start”]
dataStore?.save(testObject, response: { savedTestObject in
if let savedObject = savedTestObject as? [String : Any] {
self.testObject = savedObject
let eventHandler = self.dataStore?.rt
if let savedObjectId = savedObject[“objectId”] as? String {
let whereClause = String(format: “objectId = ‘%@’”, savedObjectId)
eventHandler?.addUpdateListener(whereClause, response: { updatedTestObject in
if let updatedObject = updatedTestObject as? [String : Any] {
if (updatedObject[self.userName] != nil) {
self.cards = updatedObject[self.userName] as? String
print(self.cards)
self.cardsUpdate(Cards: self.cards!)
}
}
}, error: { fault in
self.showErrorAlert(fault!)
})
}
}
}, error: { fault in
self.showErrorAlert(fault!)
})
}