First time variable value


#1

have this piston that i am working on which needs to check if datetime stored in a variable is after now. however, when i compare it to now it evaluates as true though its not set yet for the first run of the piston. so, it never gets to the part of the piston where the variable would get set.

anyway to fix this without doing one time workarounds?

thanks!


#2

Are you planning on checking just the time part or date and time? I believe an empty variable translates to $now when read as time. And the condition you are describing only happens once in the piston lifetime…


#3

date and time. if empty variables translate to $now, shouldnt that if condition evaluate as false?

potentially once per variable in the piston lifetime, if you check them before they are set. :slight_smile:


#4

I know this is an old thread, but someone might do a search and need this. I had a similar issue getting the piston to execute the first time when there was no initial value set for a variable. I found that I could set an initial condition in the view screen (not edit screen) in the variables box located below the piston view screen. That allowed a “kick-start” to the piston and it ran fine thereafter.


#5

Thanks for this. For those who like a visual, you can click on the highlighted pencil.

pic

(Note that different variable ‘types’ will expect different data. IE: integer, decimal, string, date etc)