Attribute Customisation - Field Validation
Hi
I have a requirement in RTC to validate attribute content to the following format :-
<PROJECT_TYPE>_ROM<YYYYDDMM>-<NUMBER> example: WR_ROM20121210-40
PROJECT_TYPE can be any of - WR, FD or UP
In RTC I have created an attribute Validator in the form of a regular expression :-
^[WRFDUP]{2}_ROM(19|20|21)\d\d(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])-\d{2}
Is there a better way I could validate this string? There is no requirement for the date part to be specifically in the past or future just that it must be in YYYYMMDD format and have valid values and that the whole string be in the specific format.
Thanks
I have a requirement in RTC to validate attribute content to the following format :-
<PROJECT_TYPE>_ROM<YYYYDDMM>-<NUMBER> example: WR_ROM20121210-40
PROJECT_TYPE can be any of - WR, FD or UP
In RTC I have created an attribute Validator in the form of a regular expression :-
^[WRFDUP]{2}_ROM(19|20|21)\d\d(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])-\d{2}
Is there a better way I could validate this string? There is no requirement for the date part to be specifically in the past or future just that it must be in YYYYMMDD format and have valid values and that the whole string be in the specific format.
Thanks
One answer
I am not aware of any easier way. You can look up proposals for reg exp in the internet using 'regular expression date' as search term. To enhance usability you could also try to use a string attribute for the string part and validate with reg exp, use a time stamp attribute and then use a script based calculated value provider to compose the result maybe as read only attribute.