cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical mapping problem

Chandra_Hota
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

siddhesh_pathak4
Contributor
0 Kudos

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

Shabarish_Nair
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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

former_member181985
Active Contributor
0 Kudos

>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

Chandra_Hota
Participant
0 Kudos

Hi Praveen

I am doing the exact same thing.

With that, i am getting this error.

Thanks

Chandra

Former Member
0 Kudos

Hi,

if you remove the source value field in the mapping it should work.

In your if statement you should check like:

sourceDate.equalsS("")

Then it should work

Regards

Patrick

former_member181985
Active Contributor
0 Kudos

Follow patrick's solution.

Chandra_Hota
Participant
0 Kudos

It worked...

Thanks Praveen & Patrick..

Former Member
0 Kudos

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