IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

Optional field empty tag problem.

  • 1.  Optional field empty tag problem.

    Posted 03/12/12 03:54 AM

    Originally posted by: Sidhumohan


    Hi,

    When I am mapping optional fields from input to output, if the data is not present I am getting empty tags sometimes.  So to avoid this I am using IF(PRESENT()) check and is an unnecessary overhead.  What cause this problem?  Any help will be appreciated.


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 2.  Re: Optional field empty tag problem.

    Posted 03/12/12 05:44 AM

    Originally posted by: TarunB


    It's not a problem, it's just the way the mapping engine works with XML parsing.

    Use EITHER instead.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: Optional field empty tag problem.

    Posted 03/12/12 06:43 AM

    Originally posted by: Sidhumohan


    But while mapping optional fields, if the data is not present means it should not generate the tag itself rght? Instead its generating emty tags and due to this problem,in all the fileds i have to use Either or IF Present check. The empty tags are creating problems while giving this output to next map.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: Optional field empty tag problem.

    Posted 03/26/12 06:57 AM

    Originally posted by: Shydhanya.D


    Hi Sidhu,

    Check the min length of the field in XSD imported TT. If min length is 1 and max say 70 then it expects data of length atleast one eventhough the field is optional. Try to change min length to 0 and import the TT from XSD.
    If the XSD field has restriction or date field in format e.g. {ccyymmdd} for the optional field still it expects data. For these fields we need to map NONE explicitly using either or if present check.

    Regards
    Shydhanya
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 5.  Re: Optional field empty tag problem.

    Posted 03/27/12 01:10 AM

    Originally posted by: Sidhumohan


    Thanks Shydhanya. i will Check this and will get back to you.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 6.  Re: Optional field empty tag problem.

    Posted 03/31/12 12:17 PM

    Originally posted by: vickey


    Import the type tree using Xceres parser and you will not have this issue. Because Xceres parser validates against schema
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 7.  Re: Optional field empty tag problem.

    Posted 04/06/12 03:26 PM

    Originally posted by: SystemAdmin


    Hey,

    Despite the Groups Created by importing the xsd are implicit, The group does not tend to eliminate the empty Tags(strange) , But if you set the range to 0:1 it definitely does not print the empty tags .
    Lobo
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 8.  Re: Optional field empty tag problem.

    Posted 03/02/16 08:47 AM

    Originally posted by: AnupRai


    Hi All,

    I am facing this same issue.

    I am passing empty tag for an optional field in input and mapping to output which is also an optional field. In output I am getting empty tags.

    I have generated TT using Xceres parser, range is also set to 0:1 and minLength of this field is also 0.

    How can I avoid getting empty tag in output if no value is passed in input without using any functions?


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 9.  Re: Optional field empty tag problem.

    Posted 03/03/16 05:13 AM

    Originally posted by: paul.brett


    It sounds like you have done everything correctly.  Can you post a simple example?  It would be better to create your own topic.

    Thank-you.

    Paul

    Follow me on Twitter


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 10.  Re: Optional field empty tag problem.

    Posted 03/03/16 05:25 AM
      |   view attached

    Originally posted by: paul.brett


    Attached is an example of using 3 XML validation methods in WTX:

    1.  Using the XSD natively.

    2.  Using the XML Schema importer with the Xerces option.

    3.  Using the XML Schema importer with the Classic option.

    ....and none of them produce empty tags.

    Perhaps you could amend this example to suit your needs, and create a new thread?

    Thank-you.

    Paul

    Follow me on Twitter


    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender

    Attachment(s)

    zip
    Optional.zip   12 KB 1 version


  • 11.  Re: Optional field empty tag problem.

    Posted 03/04/16 02:22 AM

    Originally posted by: AnupRai


    Hi Paul,

    The scenario which I am trying is when empty tag is passed in input without any values then empty tag is coming in output. Below are the input and output xmls:

    Input:

    <tns:Data>
    <tns:Stuff1>Stuff1</tns:Stuff1>
    <tns:Stuff2></tns:Stuff2>
    <tns:Stuff3>Stuff3</tns:Stuff3>
    </tns:Data>

    Output:

    <tns:Data>
    <tns:Stuff1>Stuff1</tns:Stuff1>
    <tns:Stuff2></tns:Stuff2>
    <tns:Stuff3>Stuff3</tns:Stuff3>
    </tns:Data>

    For Stuff2 if no values is passed then why empty tags are coming in output?


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 12.  Re: Optional field empty tag problem.

    Posted 03/08/16 03:26 AM

    Originally posted by: paul.brett


    Understood now.

    I do not believe it is possible to alter the Typetree properties so that the tag is not produced (if it is present on input)..

    Rules have to be used to get the output desired.

    Thank-you.

    Paul

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 13.  Re: Optional field empty tag problem.

    Posted 03/09/16 10:44 AM
      |   view attached

    Originally posted by: Laurent(Satisco)


    If you have the option of using two schemas, then the attached sample may be what you're looking for.

     

    Note that I used REFORMAT (which is not my favourite function) and Native XML schema (out of laziness, and even if it's not my favourite way of doing XML)

     

    The behavior may be different on real data, at least I had bad experiences with REFORMAT. You may succeed using teh Automapper and let it implement all the mapping at every level.

     

    What does the trick here is the constraint on the outpout schema, which requires the Elt2 element to be at least 1 character (and this is the very reason why you need two schemas since the same constraint does not validate an empty element).

     

    Hope this helps

    Laurent


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender

    Attachment(s)

    zip
    EmptyTags.zip   22 KB 1 version