on 08-08-2007 2:31 AM
Hi
In one of my scenario i have to validate the date ....
From the source i am getting date. i need to validate the date is correct or not means i need check the month and day
My source date format yyyymmdd..
i need to check dd according to month and month value should not be grater than 12.. By using UDF i achive that
venkat
Hi Venkat,
Here is simple UDF code for validating Date
your source date format must be <b>DD/MM/YYYY</b>(Just use standard Date transformation function)
create value UDF with following code
Note: <b>a</b> is your input date
{
String DatePattern = "(?:(31)(
D)(0?[13578]|1[02])
2|(29|30)(
D)(0?[13-9]|1[0-2])
5|(0?[1-9]|1
d|2[0-8])(
D)(0?[1-9]|1[0-2])
8)((?:1[6-9]|[2-9]
d)?
d{2})$|(29)(
D)(0?2)
12((?:1[6-9]|[2-9]
d)?(?:0[48]|[2468][048]|[13579][26])|(?:16|[2468][048]|[3579][26])00)$";
if(a.matches(DatePattern) )
return "Valid";
else
return "Invalid";
}
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkat,
if you want to check <b>Header</b> Node existance just use <b>exists</b> Node function.
<b>exists</b> function returns true if <b>Header</b> Node exists otherwise false.
if its <b>false</b> call UDF to raise an exception(Go through the following weblog to raise an exception)
/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi venkat,
To achieve your requirement, you have to go for UDF.
i will let you know the code to do this validation.
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.