Forum Academy Marketplace Showcase Pricing Features

Updating database records daily with math calculations

Hi,

I’m trying to automate a bunch of business logic in my database using backend functions. The simplest of which is just calculating daily and/or weekly simple interest between columns. At some point, I’ll need to start using live stock market and cryptocurrency data. But for now I just want to calculate simple interest.

E.g. Investor invests $100 on day 1 at 10% interest annually. So they should be paid a portion of interest each day based on the length of their investment and the rate of return.

I have columns setup for “Length” being days since the investment started. And “Rate” being the interest rate. Then “Interest” being Principal * Rate / 365 * Length.

I can do all of this in the front end as part of a page or view if I just want to display the data to a user as a View. But I can’t run these functions such that the Length and Interest columns automatically update daily or weekly or monthly. So the math just has to run on the front end which doesn’t seem to make sense. These figures should be saved to the database - right?

Here is my deposit button when someone adds a new asset:


And here is my Backend workflow where I’m trying to have the records update themselves daily with the new info:



Hi,

Change the event type to be “do when condition used true” and the condition is something like: currentDate is midnight (or when ever you want it to happen.

I have a similar issue, and set up a workflow (see pictured). However, I seem to only get it to trigger once per page refresh when the condition is true. I am expecting it to trigger every time the condition is true, regardless if there is a page refresh. How often would it trigger based on the screen shot depicting the settings? I’m just getting familiar with this functionality.