Resetting count monthly

I’ve searched and searched. Just wondering what is the best way to do the following:

I am recording audio in my app and I want to limit the amount of audio each user records a month.

Now:

  • I have a number field in the data base to store the length of each audio clip.
  • I add all lengths via Search for User’s Audio: each item’s audio length:sum, to get a total.
  • When total sum is greater than X the record audio button is disabled.

What is the best way to reset each user back to 0 on the first of each month? I’ve seen so many different methods including Cron-job.org

Is there a steadfast rule on this?

Really appreciate everyone’s help! Thank you

Hey @lollib :wave:

When you do the search could you filter it on created date > current date time rounded down to month? Would that work for what you need?

1 Like

That seems like it will work. Don’t see why it wouldn’t.

Going to check now. Thanks so much!

1 Like

Sounds good. Let us know how it goes. :blush:

1 Like

Hi @J805!

So your method works perfectly. Just realized, I have paying users and need it to reset monthly on the day they sign up.

I could do two things here.

  1. pro-rate billing based on sign up (seems too complicated with stripe)
  2. Adjust the monthly reset to the day (also seems confusing because months end on 28, 29, 30 and 31.

Thanks again for your help!

1 Like

If you need to reset something on the first of every month. You can run a backend workflow on the first of every month and loop it to run through each user. Then at the end of the loop you would schedule it to run next month on the first.

Or… if it is based on the user. Not sure if it’s really the best option… But you can also schedule a backend workflow to run after a month of when they sign up and loop it forever each month from then on. It should be pretty good since people will be signing up at different times and days. So it shouldn’t get too overloaded with it trying to do a bunch at one time. Unless someone has a better option/opinion about it.

Hope that helps. :blush:

2 Likes

You are the best. Thank you so much!!!

1 Like

Glad it helped. :blush: