Skip to Content
author's profile photo Former Member
Former Member

How can I create the message mapping without UDF, by just build-in function

the source like:

<source>

<item attr1="1" attr2="2" attr3="3" .../>

<item attr1="4" attr2="5" attr3="6" .../>

<item attr1="7" attr2="8" attr3="9" .../>

...

</source>

the target will be

<target>

<item><attr>attr1</attr></item>

<item><attr>attr2</attr></item>

<item><attr>attr3</attr></item>

<item><attr>attr4</attr></item>

<item><attr>attr5</attr></item>

<item><attr>attr6</attr></item>

<item><attr>attr7</attr></item>

<item><attr>attr8</attr></item>

<item><attr>attr9</attr></item>

</target>

How can I create the message mapping without UDF, by just build-in function?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2009 at 09:51 AM

    Try this out

    Source Structure

    Source
       Item  0....unbounded
         attr1     .. 1
         attr2     .. .. 1
         attr3    ....  1
    

    Target Structure

    Target
       Item  -----0...unbounded
        attr        1
    
    attr1---->removeContext()----
                                                       }   concat[.]....
    attr2....>removeContext().........                       |
                                                                           }----concat[.]......replaceString()-----collapseContext()-----Item
    attr3...>removeContext()...................../
    after remove Context of attr1 and attr2 concatenate them by dot and again do cancatenation between attr3  and previous result 
    then use replaceString to replace wherever dot comes with a string that inserts contextchange and finally map it to target item.
    
    replaceString
     X : String in which something is to be replaced(map the result of second concat())
    Y: String to be replaced in X(specify dot ".")
    Z: String to replace Y(ResultList.CC it is aConstant that shows a context change)
    R = String in which each occurrence of Y in X is replaced by Z.
     

    for attr target do the same mapping as shown above but just remove collapseContext().

    use sort () if required.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      thank you very much for so clear image.

      However, the output will be

      attr1

      attr4

      attr7

      attr2

      attr5

      attr8

      attr3

      attr6

      attr9

      what I want is

      attr1

      attr2

      attr3

      attr4

      attr5

      attr6

      attr7

      attr8

      attr9

      You said I can use sort(), but in real case, the name may not be attrX, they could be any text.

      And we tried a test with your hint, but there only output one <item> node.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2009 at 04:23 PM

    Hi,

    You need to replicate at the target the "Item node" one time for each attribute in your source.

    See the following image:

    [http://www.imagenonline.com/img_a167210.gif|http://www.imagenonline.com/img_a167210.gif]

    I hope this helps You

    Regards

    Ivan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      thank you very much for so clear image.

      However, the output will be

      attr1

      attr4

      attr7

      attr2

      attr5

      attr8

      attr3

      attr6

      attr9

      what I want is

      attr1

      attr2

      attr3

      attr4

      attr5

      attr6

      attr7

      attr8

      attr9

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.