on 08-23-2011 7:08 PM
Gurus,
I wanted to validate the date before passing that to "dateTrans" function. If the date is not valid then I need to pass and error information to the target for the particular record. I need help in validating the date format. I am expecting the date format as MM/DD/YYYY . How to validate the date. If any other date format or error data coming I need to validate.
Please help.
Kevin
Refer this udf for help -/people/robin.schroeder/blog/2006/11/21/dynamic-date-conversion-in-message-mapping
Pass the source date, target date formats (constants) and date as input.
In the exception block return the error message you want to send.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin Joseph,
Use this UDF.
public String dateValidate(String inputDate, Container container) throws StreamTransformationException{
try
{
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MM/dd/yyyy");
if(inputDate.equals(sdf.format(sdf.parse(inputDate))))
{
return inputDate;
}else{
return "Date is not valid";
}
} catch(java.text.ParseException pE)
{
return pE.toString() + "Wrong date format";
}
}
Regard,
Raghu_Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin,
You can use a Graphical Mapping as:
[http://www.freeimagehosting.net/39ebe]
But it is better to use a Java UDF.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.