Validation Expression

0
Good Day Mendix Expert, I would like to ask how can I write custom expression validation when selecting date? This is my current Validation expression:  $value != empty and $value > [%CurrentDateTime%] I want to create that value is null and should be greater than date today, 3PM I need to check if the selection is between today‘s date 3pm? meaning after 3pm selection is not allowed        
asked
2 answers
1

It is probably best to perform the following actions:

Check if the value is filled

Check if the value is from today (value > trimToDays(currentdatetime))

if it is filled, perform a formatDateTime(value, ‘H’) > 15

H returns the value of the hour in a value between 0 and 23. So by checking if it is above or below 15, you will check 3PM

answered
1

The rule : $value != empty and $value > [%CurrentDateTime%] states that the value shouldn't be empty and should be in the future.

If you want a validation for past i.e. allowed values are less than current date time, it needs to be $value != empty and $value < [%CurrentDateTime%] 

If you want a validation for values between start of current day but less than current time, it needs to be : $value != empty and $value > [%BeginOfCurrentDay%] and $value < [%CurrentDateTime%]

answered