Not sure if this would be the right spot for this since there may be some way of doing this that I am not thinking about but…
I have any interesting challenge I am trying to solve. I want to trigger an event which is an API workflow based on a variable number of days once they become inactive.
delay in days as an integer/number.
The calculation would be something like:
when the users last active time was greater than 20 days ago
or in bubble venacular:
last active > currentdatetime +days: -20
except as i mentioned i want to use the variable ‘delay’ instead of -20.
Bubble doesn’t seem to allow a variable after negative, although a static number will work.
Is this something that could be added or perhaps also adding ‘-days’, ‘-mins’ etc. as well?
If anyone has a way to do this that I am not seeing please let me know.
There maybe someway to inverse the negative by multiplying it by -1.
Here is a few screenshots to illustrate my issue better:
This would work because I reverse the negative by moving it to the other side of the equation:
Doing this from a search field is a no go using a variable, although the follow DOES work with a static number as shown:
Because it is a constraint. What I would like to use there in the 2nd pic is:
Last Active <= Current date/time +(days): -variable
or
Last Active <= Current date/time -(days): variable
It seems really counter intuitive to me but I can get around this by putting a custom state on the form and an invisible input box containing a formula to do what I need, then using that as a variable in the workflow.
I still don’t understand why all the same formulas for inserting dynamic data aren’t the same everywhere.
Def feel like some additional work is needed on Bubble in this area.
There’s another hack. You run into this issue because Bubble’s interpretter engine thinks your expression is complete, hence no further operations are allowed:
The trick is to stop Bubble’s interpretter from thinking you’re done. SImply change the +days to a an incomplete expression, such as “range”:
Complete your expression, then flip the operator back to your original. Magic.
Bubble’s engine is smart enough to know the (* -1) operator is to be applied to the matching numerical type of your variable and not applied as an ending operation to a resultant date because the type is mismatched.