cancel
Showing results for 
Search instead for 
Did you mean: 

mapping and creating new instances of a node and its sub-nodes

Former Member
0 Kudos

hi,

i need to map every 3 items from source interface to 1 in target interface.

i have on target interface parent node which is called 'item' and occurs 0..unbounded (and other sub-nodes).

this node have a sub-node which is called 'item_data' and occurs 0..3.

i created a mapping:

source_item ->counter->checking mod 3--->if

"""""""""""""""""""""""""""""" source_item -


> then -


>item.

when i test mapping with 1-3 source_item the sub-nodes 'item_data' are created,

but when i try 4-5 and more , 'item' node is created twice but the second instance has no sub-nodes of

'item_data' (it has other sub-nodes).

can someone tell me how to solve my problem?

thanks in advance.

Tomer

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

sub-node in target is in the same structure of a source item.

each parent target node needs to contain 3 items from source items

(or less if the number of source items is not divded by 3)

Former Member
0 Kudos

I would like to be clear about the requirement first,

Source Target

item -


> item

item_data -


> Item_data

item -


>

item_data -


> irem_data

item -


>

item_data -


> item_data

item -


> item

item_data -


> item_data

item -


>

item_data -


> item_data

item -


>

item_data -


> item_data

for the mapping of item node the queue should look like:

[]

-


contextchange

-


[]

Then for the mapping of item_data the queue should look like:

item_data

item_data

item_data

-


context change

-


item_data

item_data

item_data

I guess you have used some udf for the target parent node (item) mapping. I am trying myself to generate the queue for item_data using standard functions, but yet to come up with the desired result. If achieved will let you know..................for now it seems that writing a UDF (queue) would be the best approach.

iterate through the input queue array (source item_data values all in same context using RemoveContext) and insert a ResultList.CC after every third element in the array.

Hope you can come out easily with the java for this logic. Let me know if it's helpful.

Regards,

Suddha

Former Member
0 Kudos

The mapping for the Item target node can be done using the following logic with Standard function,

Item (Source) -> removeContext-> index(0,1,entire)

-> div (by 3) -> floor -> SplitByValue(value change)

-> collapseContext -> Item (target)

The queue should look like

0

1

2

Child Field (item_data) mapping

generate the queue as above mapping but upto SplitByValue and use this queue as an input to FormatByExample function.

queue looks like:

0

0

0

---

---

1

1

1

---

---

2

2

item_data(source) -> FormatByExample

queue (gentd above) ->

Hope this will give you the desired result.

You may have a look at this veru useful blog:

https://www.sdn.sap.com/irj/sdn/profile?editmode=true&userid=3670343

Regards,

Suddha

Edited by: Suddhasatta Guha on Aug 11, 2008 3:21 PM

Former Member
0 Kudos

i will try to explain my probelm better and hope that you will tell me how to map it.

source interface: source_item 0..unbounded.

target interface: item(parent) 0..unbounded

item_data (child) 0..3

i need to group every 3 items from source items to 1 item in target

(many items in target, each contain 3 from source).

how do i have to map parent and child?

Former Member
0 Kudos

Where from you get the value for Target sub node item_data? Which source field needs to be mapped with this child field? Without this information cannot comment about how to map the subnode. The mapping for target node item looks just fine.

Regards,

Suddha

Former Member
0 Kudos

Hi Tomer,

Can you please share the mapping for the item_data field as well. That would help us to tell you if there is a context/queue problem in the child field mapping. From the initial symptomps it seems that the target queue context doesn't match (shorter) with that of the parent node item.

Regards,

Suddha

Former Member
0 Kudos

Tomer,

Check the context of the source field as it creates new nodes with blank data if the condition is not satisfied.

Right click on the source field to access Context.

I hope this helps..

Thx

PSR

Former Member
0 Kudos