on 03-24-2009 11:13 AM
Hi All
I am using graphical mapping, and i have a problem.
I am mapping source date field to target date field (both fields are of type xsd:date, and both has occurance 0 to 1). My source value can be blank(null)
Initially It was a direct one to one mapping, and there was no problem.
But, when i use TransformDate function to transform source date format ddMMyyyy to target date format yyyy-MM-dd, i get the following error when there is no source value:
Unparsable date:""
I am passing a null value, but as the occurance is 0 to 1, shouldn't it take care of null source value?
Then, i changed the mapping as following:
If(source date) exists
then sorucedate -> TransformDate -> Targetdate
else constant "" -> Targetdate
Even with the above mapping, i get the same error: Unparsable date: ""
Can someone tell me what is going wrong here?
Thanks
Chandra
Hello,
Use the UDF,
for(int i=0; a.length>i;i++)
if(a<i>.length() == 8 && !a<i>.equals("00000000"))
result.addValue(a<i>);
else
result.addValue("");
Then try the below mapping, you can modify the UDF as per your requirement,
sorucedate -> UDF -> Equals -> NOT -> IF -> sorucedate -> Transformation -> Target date
Constant(blank) ->
If you want to pass the space then use IF-Else.
Edited by: Siddhesh Pathak on Mar 24, 2009 12:33 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Note that Mapwithdefault logic will not work since the input to transformdate will require a valid date.
It is better to use the IF ELSE logic as mentioned by Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check it date NOT equal to "", then use DateTransform
compare date with "" --> NOT > IfWithoutElse-> DateTrasform
Edited by: Mugdha Kulkarni on Mar 24, 2009 12:36 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>If(source date) exists
>then sorucedate -> TransformDate -> Targetdate
>else constant "" -> Targetdate
the problem is after with "IF block" you are mapping to "TransformDate block" so the above logic doesnt work as you are passing empty value to TransformDate.
change the logic as follows
(source date---> exists) map to "IF" node of IF Block.
(source date-->TransformDate) map to "then" node of IF block.
( Constant ""--> ) map to else node of IF block.
The output node of IF block should be mapped to Target Date.
Edited by: Praveen Gujjeti on Mar 24, 2009 4:58 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
do yo mean with blank ""?
Then it's something different than not existing.
You should then check in your if statement source not equals "".
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.