Hi All
In an editable grid we used a text field as a time enter field . Currently we want to do validations as follow in the text field 9:02 AM in the editable how to achieve this scenario.
Discussion posts and replies are publicly visible
hi nizara0003, Its difficult to understand your requirement , could you please explain little bit more about your use case?
Hi
In editable grid we need to have time field in appian we don't have time field in editable grid. So to have time field i used text field. Now the problem is its accepting all the values. Here i need to check the text field has to accept only time else need to throe some validation message.
Ok. May i know why are you using text field ? is there any restriction on using date field?
Only time we need to show not the date.
it would be difficult to implement a validation on a text field like this unless you have proper format for time entered by the user. Also you can use helptooltip to give brief about the time format to be entered by the user.
Does this have to be a text field? Would it be sufficient to use a drop down with 30-minute intervals?
Hi there,
You can use validation in the below manner. Split the text on semicolon(:) and check there should be 2 values. On the first value, the integer value should be greater than equal to 0 and lesser than 25.On the second value, split it again on space( ) and check there should be again 2 values. The first value should be again in the specific range. The second value should be one of them AM, PM, am, pm
This kinda makes me wish they'd finally implement some sort of sideBySideLayout compatibility in an Editable Grid cell, because then this use case could be satisfied by one integer field for HH, one for MM, and a dropdown for AM/PM.
If you're prepared to force the user to use a fairly strict format, you could use RegEx to validate that the user enters text in the exact format of HH:MM AA.
a!localVariables( local!24hourmatch: regexmatch( /* requires 2-digit hour from 00 thru 23 */ pattern: "^(0[0-9]|1[0-9]|2[0-3]):[012345]\d$", searchString: ri!timeText ), local!12hourMatch: regexmatch( /* requires 1 or 2-digit hour from 1/01 to 12, plus AM or PM (case insensitive) */ pattern: "^(0?[1-9]|1[012]):[012345]\d [AP]M$", searchString: ri!timeText ), or( local!12hourMatch, local!24hourmatch ) )