Forum Academy Marketplace Showcase Pricing Features

Action based on currentdatetime days: (-) variable

Hey Team,

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.

If you have some ideas, please let me know.

Thanks!

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:
Screen Shot 2020-05-31 at 22.35.17

Doing this from a search field is a no go using a variable, although the follow DOES work with a static number as shown:
Screen Shot 2020-05-31 at 22.34.56

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

No one seems to be taking here.

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.

1 Like

Yep, that’s exactly what I did

I’m having the same problem at the moment. I came up with the same workaround…invisible input box to reference.

I found it!!

range data = date1’s value + (days): arbitrary :converted to number

airbitrary= - number

image

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:

image

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”:

image

Complete your expression, then flip the operator back to your original. Magic.

image

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.

1 Like