cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping 2 layers to 3 layers

Former Member
0 Kudos

Is it possible to map a 2 layers XML to 3 layers XML ?

The purpose is merge the "option" into "order_detail" (the relation key is "order_detail_id")

<b>Source:</b>


<order_header>
    <order_detail>
        <order_detail_id>order_detail_1</order_detail_id>
        <order_detail_name>order_detail_1</order_detail_name>
    </order_detail>
    <order_detail>
        <order_detail_id>order_detail_2</order_detail_id>
        <order_detail_name>order_detail_2</order_detail_name>
    </order_detail>
    <option>
        <order_detail_id>order_detail_1</order_detail_id>
        <optA>opt1A</optA>
        <optB>opt1B</optB>
    </option>
    <option>
        <order_detail_id>order_detail_2</order_detail_id>
        <optA>opt2A</optA>
        <optB>opt2B</optB>
    </option>
</order_header>

<b>Target:</b>


<order_header>
    <order_detail>
        <order_detail_id>order_detail_1</order_detail_id>
        <order_detail_name>order_detail_1</order_detail_name>
        <option>
            <optA>opt1A</optA>
            <optB>opt1B</optB>
        </option>
    </order_detail>
    <order_detail>
        <order_detail_id>order_detail_2</order_detail_id>
        <order_detail_name>order_detail_2</order_detail_name>
        <option>
            <optA>opt2A</optA>
            <optB>opt2B</optB>
        </option>
    </order_detail>
</order_header>

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

This is absolutely possible. It will be easy if the <optios> element occurs in the same order as <order_detail> element.

For that case Map as follows:

OrderDetail -


> OrderDetail

option ---> splitByValue ---> options(target side)

optA -


> splitByValue -


> optA

optB --> splitByValue --> optB

If you need to check condition for <order_detail_id> then UDF might be a good solution.

Regards,

P.Venkat

Former Member
0 Kudos

Dennys,

We had a similar requirement like this and we solved it using JAVA ampping. This can be accomplished in JAVA mapping. But let us wait and see, if some one has some idea to solve using Graphical Mapping..

Regards,

Jai Shankar

prabhu_s2
Active Contributor
0 Kudos

def yes. u can check with

<a href="/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool">/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool</a>

Former Member
0 Kudos

Hi Dennys,

this is possible with graphical mapping. You do <b>not</b> need multi-mapping.

Just make sure that the occurances in the datatype for the target, field <option> are min = max = 1.

Also make sure that in source <option> is as often available as <order_detail>.

Regards Mario

null

Former Member
0 Kudos

Thanks all replies. But it still doesn't work.

I checked <a href="/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool:///people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool,

but it's "split", I need "split+merge" (merge the option into order_detail)

And I also use this mapping

OrderDetail -


> OrderDetail

option ---> splitByValue ---> options(target side)

optA -


> splitByValue -


> optA

optB --> splitByValue --> optB

But when I have many "order_detail" elements, optA and optB only appear in first "order_detail"

Sorry, the structure in my first post is not very correct, I put it here again, could you help to check it ? thanks.

<b>Source:</b>


<order_header>
    <order_detail>
      <item>
        <order_detail_id>order_detail_1</order_detail_id>
        <order_detail_name>order_detail_1</order_detail_name>
      </item>
      <item>
        <order_detail_id>order_detail_2</order_detail_id>
        <order_detail_name>order_detail_2</order_detail_name>
      </item>
    </order_detail>
    <option1>
      <item>
        <order_detail_id>order_detail_1</order_detail_id>
        <optA>opt1AA</optA>
        <optB>opt1BA</optB>
      </item>
      <item>
        <order_detail_id>order_detail_1</order_detail_id>
        <optA>opt1AB</optA>
        <optB>opt1BB</optB>
      </item>
      <item>
        <order_detail_id>order_detail_2</order_detail_id>
        <optA>opt2A</optA>
        <optB>opt2B</optB>
      </item>
    </option1>
    <option2>
      ... (the schema is almost the same as option1)
    </option2>
</order_header>

<b>Target:</b>


<order_header>
    <order_detail>
      <item>
        <order_detail_id>order_detail_1</order_detail_id>
        <order_detail_name>order_detail_1</order_detail_name>
        <option1>
          <item>
            <optA>opt1AA</optA>
            <optB>opt1BA</optB>
          </item>
          <item>
            <optA>opt1AB</optA>
            <optB>opt1BB</optB>
          </item>
        </option1>
        <option2>
        </option2>
      </item>
      <item>
        <order_detail_id>order_detail_2</order_detail_id>
        <order_detail_name>order_detail_2</order_detail_name>
        <option1>
          <item>
            <optA>opt2A</optA>
            <optB>opt2B</optB>
          </item>
        </option1>
        <option2>
          ... (the schema is almost the same as option1)
        </option2>
      </item>
    </order_detail>
</order_header>