How to check if a variable with Time data type if empty or null ? I tried VarTime = "" and TimeToText(VarTime ) = "" but it's no good.
Hi @CoffeeCode ,
Unfortunately there is no built in action to check the empty time but you can validate the time as shown below,
But what if the user selects 12am in 24 hr format ?
If user is selecting the time from date widget or time widget then there should be difference in the seconds so above approach will work.
Approach 2:
Instead of directly using the time datatype variable in the screen I suggest you to use text datatype variable and then convert the text value to time.
Please use the below link to test it
Test Link
One way to check if the time is null is by using the following condition, using DateTimeToDate to convert NullDate allows the time comparison to work properly.
VarTime = DateTimeToTime(NullDate())
For your use case regarding 12 AM in the 24-hour format, OutSystems does not support an explicit "null" value for Time data types. Instead, unassigned time values default to 00:00:00.
To determine whether the user has actually selected a time, consider implementing a Boolean variable (IsTimeSet):
just offering an alternative to everything else here.
Make both on server and client side a function called NullTime, with as output a time attribute. No code needed in the function, the default value of the output is what you are after.
Then, you can just make expressions like this
which I think is
Dorine