Predictive Math in Database

Hi, all! I am wondering if anyone knows if we can somehow code math into our databases. For instance, the user enters a number into a field when setting up their user profile. Based on that number, a different field will calculate a new result by adding, say, 10 to the original number.

So, user inputs 25 into Field A
Field B calculates Field A plus 10 and returns a result of 35.

Can we do this?

Hi, thanks for your interest in WixCode.

Take a look at the wix-dataset onBeforeSave() method. This method “catches” the field before it’s saved to the database allowing you to manipulate it as you see fit.

All the best

Also, see here about Data hooks.
On of these options should be enough :slight_smile:

Liran.

Thank you, gentlemen. I will see if I can figure out an answer using one of these methods.