isValid syntax for non-standard date formats
Posted: Thu Feb 16, 2012 7:43 pm
Hi,
I am currently trying to validate a column in my input file that should contain a date.
The date format that I need to validate is as follows:
However there are non date entries (3, ABCD) coming in as well and I need to write these invalid records to a reject file.
I would like to know the correct syntax when using the isValid function for 'non-standard' date formats.
Here are the things I have tried so far:
Could someone let me know the correct syntax for isValid or a way to override the default date format '%yyyy-%mm-%dd'. We are using DataStage 8.0.1.
Please do not give me examples of the StringToDate function as a 'solution'. There are enough of those out there for people to search
.
Thanks
Abhijit
I am currently trying to validate a column in my input file that should contain a date.
The date format that I need to validate is as follows:
Code: Select all
Mar 1 2005
Mar 17 2005
I would like to know the correct syntax when using the isValid function for 'non-standard' date formats.
Here are the things I have tried so far:
Code: Select all
isValid("date",InLink.DateToValidate)
Error:
Data string '3' does not match format '%yyyy-%mm-%dd': the value for tag %yyyy has fewer characters than expected.
isValid("date[%mmm %(d,s) %yyyy]",InLink.DateToValidate)
Error:
The schema type "date" does not take parameters "%mmm %(d,s) %yyyy"
isValid("date %mmm %(d,s) %yyyy",InLink.DateToValidate)
isValid("date(%mmm %(d,s) %yyyy)",InLink.DateToValidate)
Error
Parsing parameters for schema type "date": Expected "[" or EOF; got: "%"
isValid("date",InLink.DateToValidate["%mmm %(d,s) %yyyy"])
Error
Data string '' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %yyyy.
isValid("date",InLink.DateToValidate,"%mmm %(d,s) %yyyy")
Error
This comes out as an invalid derivation.
Please do not give me examples of the StringToDate function as a 'solution'. There are enough of those out there for people to search
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Thanks
Abhijit