on 04-12-2010 12:22 PM
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
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.