Hello, I would like to know if it is possible to add more than one calculation in one data hook. I’m planning to insert two separate formulas to fill in two different fields in my database, for example Total (sum of all fields) and also Grand Total (sum of Total and tax - in which Tax is also calculated separately). I have managed to insert the first formula, but I’m not sure how to insert the other formula… if this makes sense.
Hi Ana,
of course it is possible, the pros and cons should be long term engineering design concerns
with current hook implementation we can not guarantee their execution order so if there are multiple iterations it will be better if you manage those yourself
Shlomi
Hi Ana,
When using hooks such as the beforeInsert or beforeUpdate, you receive the item that will eventually be added to the collection. The hook allows you to edit the item before it is added and is not limited to one calculation.
You can learn more about hooks here
Thank you so much Shlomi and Ido! It worked heheh