Hey @cryptokid,
This is the function I am currently using:
Moralis.Cloud.afterSave("PlayersEntered", async (request) => {
//get address of whoopy which player entered
const confirmed = request.object.get("confirmed")
if (confirmed) {
const CreatedWhoopys = Moralis.Object.extend("CreatedWhoopys")
const createdWhoopys = new CreatedWhoopys()
const query = new Moralis.Query("PlayersEntered")
query.equalTo("address", request.object.get("address"))
const result = await query.first()
//Find corresponding row in Created Whoopys table based on address from previous query
const query1 = new Moralis.Query("CreatedWhoopys")
const currentValueRow = query1.equalTo("address", result)
currentValueRow.increment("playersEntered")
await currentValueRow.save()
What I want to do is basically increment the value of Players entered in the CreatedWhoopys table, however I want to specifically update the value based on whoopy address which I get in the PlayersEntered table. Both tables have an ‘address’ column.
I have queried the whoopyAddress from PlayersEntered table but now I can’t figure out how to increment the playerEntered value in the CreatedWhoopys table according to that particular result.
Is it possible for me to do a function similar to this:
//increment the column players entered in that specific row
currentValueRow.increment("playersEntered")
Thanks!