Compare enumartion

0
Hi,   I made 2 seperate enumerations for start- and endtimes, as I have to follow a certain time table. For example starttime can only be 8.30, 9.15, 10.00, 11.00, 11.45 etc.. Endtime can only be 9.15, 10.00, 11.45 etc.   When a user fills in a form, I want to validate that the starttime does not begins after the endtime, for example: if a user enters 12.30 as starttime the endtime cannot be 11.00. However, because I made an enumeration I cannot compare 2 values. Is there a way to validate this?   Thanks in advance!  Kind regards, Ralph
asked
4 answers
1

Hi Ralph,

my mistake,

this is the correct expression:

parseDateTime(toString($StartTime ), '_HH_mm') < parseDateTime(toString($EndTime), '_HH_mm') 

answered
0

Hi Ralph,

 

to complete the task you should use a expression like this:

 

parseDateTime(toString($StartTime ), 'HH.mm') < parseDateTime(toString($EndTime), 'HH.mm') 

 

let me know if it works :)

Andrea

answered
0

Hi Andrea,

 

Thank you for your quick response. Is it right that I have to create a microflow in which I process this expresssion?

 

My idea is that when a user presses "Save", there will be a validation that starttime is before eindttime.

 

Ralph

answered
0

Hi Andrea,

 

Thank you so much, it seems I didn't link to the right variable. I managed to fill in the expression without getting an error, however when I try it out, Mendix says “An error occured, please contact your administrator”.

 

I thought this happened because I use a 10:15 notation instead of 10.15, so I changed HH.mm in the expression to HH:mm. This didn't work. After that I tried to change the 9:15 enumeration to 09:15, but this also didn't have any effect.

 

Any other ideas? :) 

answered