Tracking real time changes in database

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!)
})
}

Hi Amit,

The whereClause you use creates a condition where you monitor the changes for a specific objectId, which goes against to what you described when you said that you “want to track changes in a specific column regardless of objectId”. If you need to track changes based on a value in a specific column, you should modify the whereClause in the addUpdateListener accordingly.

Hope this helps.

Regards,
Mark