hi,
i have two collectons, one is colled royaldynasty and the other is called Variables.
i want that every time data enters the royaldynasty collection there be a function in the Variables collection that takes the value of the item in the first row in the column kingsFortune in the royaldynasty collection, and insert that value in the first row in the column currentFortune.
so i think i need to use the afterinsert() but i dont know how to write that when the data is inserted from a differnt collection. and how i write the code that take the item frim the first row in a specific column.
i will love if someone will show me how to write the code and explain to me so in the future i could write code by myself, thanks from advance and sorry for the bad english :).
Hello Dor,
You can use Hooks to perform certain actions after a database has been updated.
The hook should execute after or before royaldynasty is updated and query() the Variables collection.
To sort the result list by date, set WixDataQuery to ‘ascending’ by UpdatedDate.
We are here for any further questions