Create a new thing based on a text elements value on a schedule

Hi,
Hopefully someone can make my Friday and help me please, I have a text field that dislays a number as a percentage, this value is not stored in a database and is calculated in realtime all the time.

I would like to save that value once per month to my database. My challenge is how do I create a new thing based on this elements value on the condition to run just once per month.

I would be most gateful for any guidance please.

rgds
Sawan

You need a backend workflow to make this reliable, as you can not ensure that a frontend will be up and running at the needed time each month.

Backend reccuring workflow is your thing

Thank you @bonjour_17 , I had a feeling Backend makes sense, what would the condition look like to state that I only want it to run once per month?

Either option :

  • set a “reccuring backend workflow”, and then trigger it once with the “trigger a reccuring” action

  • an API backend workflow that triggers itself with a “schedule an API workflow”, and you set the date to current_date+1month

Thank you @bonjour_17 for the direxct guidance of both options, I went with the second option to create and schedule an API workflow, i have just one challenge , as the field I want to write in the database is calculated on a page itself and displayed as a text field, I can not reference the text element in the backend workflow to populate the field in the database which is a number field., would you be able to give me guidance on that please?

You should re-do the calculation totally in background. Unless the data is not accessible from the backend, but then you’ll need to tell us a bit more about the use case and what data and calculation we are talking about :wink:

Understood, I put the calculation in and it accepted it with nice blue text. So now it looks complete, thanks to you, I just wanted to confirm on the schedule an API workflow step does the current date/time+months:1 mean it will do it on the first day of the month every month ?

image

Current data+months:1 will run next month at the same day and hours/minute than today.

So right now it is jully 12 10AM59, you add 1 month it will run august 12 10AM59

In the case that the day next month does not exist (february 31 for example), I am not 100% sure but I guess is that it will run on the last day of the month (february 28)

Understood, so if I want it to start earlier I should create this whole thing on the date I want it to preferable start from, like the begining of the month rather than todays date.

Could I check one thing please, see the screen shot below, this is an API workflow that has an action inside it which schedules itseslf and and an action which populates the filed. Is this all going to run on its own or is it still expecting the actual API workflow circled in green to be triggered by something that I need to set?
image

You need to initiate the 1st call.

For this, werdly Bubble has no other solution than creating a test page with a button that triggers the 1st iteration of the workflow.

When you set the 1st call, you can decide when to schedule it, so choose the 1st day of next month.
And, then it will auto trigger every single 1st day of next months.

Understood , I can do it from user signup as it happens just once it would work, could you please help me with one last detail please in the last point you made, to trigger it every single 1st day of the month, could you guide me with the expression please?
image

@bonjour_17 I tried arbitrary date, and it gives me that mid month result again ,I am not sure if there is something else i should type to set it to be 1st day of the next month?

Given this screenshot, it seems you’ve manually chosen to initiate the first iteration on August the 12, you need to choose august 1st there.

Got it! I see what happened, I used arbitrary date and typed " first day of next month" it resolved it to 12th Aug and I concluded that was it. However your suggestion made me do the simple change of going in and now editing the 12 to 1 and here we have an accepted entry of 1st Aug. Thank you so much @bonjour_17 you have indeed made my friday and I appreciate you very much.

1 Like