cancel
Showing results for 
Search instead for 
Did you mean: 

1 to unbounded in Message Split

Former Member
0 Kudos

Hi Experts,

We have a requirement where we need to do a message split

based on the number of line items in the source message.

I have sucessfully managed to achieve the message split,

but the problem is trying to map the "1 to unbounded"

list section in the source message header to the

"1 to unbounded" list section in the target message

lineItem. If possible, please can you help me to achieve the

following result:

-


Source message:

-


<source>

<header>

<list>

<ref>

<rec1>r1<rec1>

<rec2>r2<rec2>

<ref>

<ref>

<rec1>r3<rec1>

<rec2>r4<rec2>

<ref>

<list>

<lineItem>

<item1>i1<item1>

<item2>i2<tem2>

<lineItem>

<lineItem>

<item1>i3<item1>

<item2>i4<item2>

<lineItem>

<source>

-


Target Message:

-


<target>

<lineItem>

<item1>

<item2>

<list>

<ref>

<rec1>

<rec2>

<ref>

<list>

<lineItem>

<target>

-


Required Result After message split:

-


<target>

<lineItem>

<item1>i1<item1>

<item2>i2<item2>

<list>

<ref>

<rec1>r1<rec1>

<rec2>r2<rec2>

<ref>

<ref>

<rec1>r3<rec1>

<rec2>r4<rec2>

<ref>

<list>

<lineItem>

<target>

<target>

<lineItem>

<item1>i3<item1>

<item2>i4<item2>

<list>

<ref>

<rec1>r1<rec1>

<rec2>r2<rec2>

<ref>

<ref>

<rec1>r3<rec1>

<rec2>r4<rec2>

<ref>

<list>

<lineItem>

<target>

-


-


At the moment the "1 to unbounded" list section is not mapping correctly.

I need a function similar to the useOneAsMany function to achieve this

because I cant get the useOneAsMany to work with the "1 to unbounded"

list section. I have tried creating my own UDF but for some reason it

only generates 1 reference record in the second target message instead of 2.

I have been struggling for ages to achieve the required result above

but still have not been successful. Any help will be appreciated very much.

Thanks and regards,

Brendon

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Brendon,

I hope the given solution will work for you! If any issues, please let us know

Mapping

http://www.flickr.com/photos/8764045@N06/4514926701/sizes/o/

http://www.flickr.com/photos/8764045@N06/4515563978/sizes/o/

http://www.flickr.com/photos/8764045@N06/4514926759/sizes/o/

http://www.flickr.com/photos/8764045@N06/4514926895/sizes/o/

UDF's

http://www.flickr.com/photos/8764045@N06/4515564064/sizes/o/

http://www.flickr.com/photos/8764045@N06/4514926851/sizes/o/

Result

http://www.flickr.com/photos/8764045@N06/4515564202/sizes/l/

UDF code's for your reference

zuseOneAsMany


for(int i=0;i<LineItem.length;i++)
{
for(int j=0;j<Ref.length;j++)
{
result.addValue("");
}
result.addContextChange();
}

z1useOneAsMany


for(int i=0;i<LineItem.length;i++)
{
for(int j=0;j<Record.length;j++)
{
result.addValue(Record[j]);
result.addContextChange();
}
}

Thanks!

Former Member
0 Kudos

Hi Raj,

Thank you very VERY much. This is exactly the solution I need.

Thank you,

Brendon

Answers (0)