Catalog Item - No Time Only Variable

Matt20
Tera Expert

I'm working on creating a new Catalog Item for requesting a scheduled report.  As part of this I need a way for the requester to enter what time of day they want the report to run, but there is not a variable for Time only.  There is Date and Date/Time.  I did some digging and it looks like people are using Select Box variables and populating them with options for every 30 minutes throughout the day, but I'm looking for someone that allows them to enter a specific time down to the minute.

Does anyone have some suggestions on how I can get this done?

1 ACCEPTED SOLUTION

Brian Lancaster
Tera Sage

You could single line text field with some examples of the format.  Then use a regular expression to validate what they have entered.  Example regular expression below for 24 hour clock.  

24 Hour clock

/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/

12 Hour clock

/((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))/

View solution in original post

8 REPLIES 8

Brian Lancaster
Tera Sage

You could single line text field with some examples of the format.  Then use a regular expression to validate what they have entered.  Example regular expression below for 24 hour clock.  

24 Hour clock

/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/

12 Hour clock

/((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))/

Thanks Brian.  I had thought of that as well, but I'm really hoping for something where the requester doesn't have to key in a time.  I feel like I could run into some issues with people not following the correct format for entering the time.  Trying to find a solution that's idiot-proof.

That is what the regular expression is for.  If they don't put in the correct format you wipe out what the have and make them try again.  Usually put an alert "The time must be put in the following format xx:xx base on a 24 hour clock"

Thanks Brian.  This ended up being a good solution to what I was hoping to get done.