I have these actions that create various stuff when the user presses a button, but if the user presses the button again it obviously creates them again, but i don’t want that, i want it to modify the existing stuff every subsequent time the button in pressed on the same day. So basically “oh you havent created this stuff today [*creates]” and then if the user presses it again its like “oh you pressed this thing again today uh? well we wont create new entries for this we’ll just modify it because it’s still the same day we created it”
I vaguely remember there being a “modify if already exists” function in bubble but i could be wrong.
The condition needs to be on the button press, checking if the thing was created for that day already. If not then schedule that workflow.
Then copy/paste the workflow on the same button, but make the condition opposite, and schedule a different API workflow all with Make changes to a thing actions instead.
Is there anyway to do it on the same workflow?
I wouldn’t put like all the actions in one workflow cause tons of conditions on each action always ends badly.
But you could have that API workflow schedule two workflows. One has the condition and create actions. The other having the opposite condition and modify actions
So Button press → Schedule API Workflow → Schedules the next appropriate workflow when condition is met
I guess you can try squeezing actions in between other actions (with conditions on everything) but I have no idea what will conflict, because one action could be searching for if something exists, and the previous one just created it, worth trying if you really need it like that
Nah i’ll do your first idea: button press triggers the WF that creates (but this time with an "only when todays rows in DB are empty) then another WF that also happens on the button press that modifies it only when the rows have already been created today. ?? is that right??
Will this front end way of doing be slower though
Yep pretty much. Usually it would be a search for something (constraining to todays date) :count is 0
Then the other one :count > 0
Honestly if you could put this all in the front end custom events it would be way faster than scheduling API workflows
I meant like UX speed not like final db result speed
It will take a sec regardless cause it needs to schedule the workflow, I would put the two workflows on the button press and see if its manageable, if not then do the 2nd option where one API workflow schedules the next one you want. Might not be any faster that way tho
Front end custom events would be faster it’s not scheduling anything and the DB actions would happen quicker
1 Like
Ok dude, can you check my work on the expression and the constraints for the create one (ignore the first part of the expression which is unrelated):
What is it not doing correctly
Also add another constraint Created Date < Current date/time + days (1):rounded down to date
Change yours to :rounded down to date not day as well
Yeah you’re right i need that second constraint, but i don’t think i need “date”. I remeber i asked the same question almost exactly one year ago and someone help me set it up like this:
Want’s the difference between using day vs date??
day is 8:00 o clock (why is this even a choice, who picks 8am for anything with no other choice)
date is 0:00 (or 12:00am I guess) o clock
i thought rounding down to “day” WAS to 00:00?
Let me look this up again, pretty sure what I said was true but hold on…
1 Like
I just tried both and they are giving me the same date/time…
Haha ok cool i’ll stick with “day” as that’s what i’ve used elsewhere.
I have another question relating to this.
What we talked about is the set up for when a user presses the button, which either will run the modify WF or run the create workflow.
But i also have a WF that runs at 1 minute before midnight that needs to do these two functions regardless of if the user has pressed the button today.
For this, i already have a create action working but i want to add an action that schedules the modify wf.
Here is what i have done. I just added a new step 1 action that schedules the modify workflow if there are existing entries (just like we did on the front end button version of this), then i have step two action that is schedualing the wf that creates the rows if they don’t exist.
Will this work in that it will either execute step one or step two (depending on condition)?