Skip to Content
avatar image
Former Member

Graphical mapping problem

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Mar 24, 2009 at 11:25 AM

    >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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 24, 2009 at 11:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 24, 2009 at 11:26 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 24, 2009 at 11:28 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 24, 2009 at 11:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded