cancel
Showing results for 
Search instead for 
Did you mean: 

Help With Mapping n:m Scenario

Former Member
0 Kudos

Hello All,

I Have 2 messages one header and and one item. Will look something like below

Header message:

H1;012-003;123456789;

H2;012-003;987654321;

Item message:

I1;012-003;123456789;

I2;012-003;123456789;

I3;012-003;123456789;

I4;012-003;987654321;

I5;012-003;987654321;

Output should look something like below:

H1;012-003;123456789;

I1;012-003;123456789;

I2;012-003;123456789;

I3;012-003;123456789;

H2;012-003;987654321;

I4;012-003;987654321;

I5;012-003;987654321;

Header and item are 2 different messages which are to be mapped to a single message in message mapping.

Am also doing a removecontext for the item node on the target, but for some reason all the 5 items appear in the target message on testing the map. Tried putting some variables and if conditions, with out any help.

Any suggestions would be very much helpful..

--Prashanth

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member518917
Participant
0 Kudos

Hi,

You can try this:

assuming Input Structure is

Input

Header 0..onbd

Head1

Head2

Head3

Items 0..unbd

Item1

Item2

Item3

And Output Structure say :

Output

Records 0..unbd

Header 0..1

Head1

Head2

Head3

Items 0..unbd

Item1

Item2

Item3

Mapping :

Source Target

Header -


<Removecontext> -


> Records

Header----


>Header

Head1----


>Head1

Head2----


>Head2

Head3----


>Head3

[ Head3,Items3,Item3-[UseOneAMany] --- If equals Item3 Then Item3 - Remove context - SplitByValue (value change) -


-


>Items

]

Item1----


>Item1

Item2----


>Item2

Item3----


>Item3

Ritu

Former Member
0 Kudos

Hi Jude,

They are 2 common fields in the header and item messages which remain the same, they can be related. I copied the 2 header values into 2 variables and then tried to use that variables as an IF condition on the item fields.

Is this the way? Could not find proper blogs for this requirement. Appreciate if you can forward me the blogs.

--Prashanth

Former Member
0 Kudos

Hi,

The no. of items for each header is sent as a numeric field in the source. Is there anyway I can use that field to restrict the occurrences.

---Prashanth

Former Member
0 Kudos

Hi Gurram ,

Its very easy ...try to find the help of the node functions.

You can find many good examples in SDN.

When i look into the example , you shd need a condition to split the Item detils , bco'z u have 5 line item and 3 moved to header 1 and other 2 moved to header 2 .( What is the condition)

Any Primary key ?

Any unique Field ?

Regards,

B.Jude