on 12-30-2009 3:38 AM
Hi all,
I am looking for a way to split my source message into multiple target messages based on the Material element.
My Source and Target structures are exactly the same.
What i am trying to do is read from a order related flat file with multiple Materials and then create multiple flat files based on each material. So basically, each target file will have all the order info for EACH material.
In MM i tried to change the occurance of the target message from 1 to 0..unbounded but was not succesful.
Any help is appreciated. Please see below example source and desired target messages
Source Message:
<Header>
<GUID1>E663336789</GUID1>
</Header>
<Data>
<Order>50000890</Order>
<Material>Mat1</Material>
</Data>
<Data>
<Order>50000891</Order>
<Material>Mat2</Material>
</Data>
<Data>
<Order>50000892</Order>
<Material>Mat1</Material>
</Data>
<Data>
<Order>50000892</Order>
<Material>Mat2</Material>
</Data>
Expected Result ->First Split Message
<Header>
<GUID1>E663336789</GUID1>
</Header>
<Data>
<Order>50000890</Order>
<Material>Mat1</Material>
</Data>
<Data>
<Order>50000892</Order>
<Material>Mat1</Material>
</Data>
Expected Result ->Second Split Message
<Header>
<GUID1>E663336789</GUID1>
</Header>
<Data>
<Order>50000891</Order>
<Material>Mat2</Material>
</Data>
<Data>
<Order>50000892</Order>
<Material>Mat2</Material>
</Data>
Yes you are right, target occurrence has to be unbounded
mapping for target root node MT_target
material --> sort --> collapse context --> MT_target
GUID1 mapping
you need to generate GUID1 as many times as many materials. useOneAsMany logic should be incorporated. Also split by value is required to manage context
Map Order and Material accordingly so as to get same material into one message
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rodney,
Pls try out the below mapping.It should solve your issue.
Material>removeContexts>sort>SplitByValue(value changed)>Order_MT
Material>removeContexts>sort>SplitByValue(value changed)>Header
GUID-->
Material> removeContexts -
Material--> removeContexts -->
Data>removeContexts>
formatByExample-->Data
Material--> removeContexts >sort>splitByValue(value changed)-->
Material>removeContexts>
sortByKey--
Order>removeContexts>
Material>removeContexts>sort>SplitByValue (EachValue)>Material
Material>removeContexts>sort>SplitByValue (EachValue)>Material
Rgds,
Lekshmi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lekshmi,
I tried your suggestion but am facing some problems. Based on certain combinations of Material#'s that i enter, sometimes the message split works correctly and sometimes it does not work correctly. At times, it would even create an empty 'Inbound_Msg1_MT' element. In the below example, i should be seeing 2 messages - one for 'Mat1' and the other for 'Mat2', but i just see 1 message split for 'Mat1'.
Any suggestions? TIA
Source
<ns0:Message1>
<ns1:Outbound_Msg1_MT xmlns:ns1="http://Test/Test">
<Header>
<GUID1>HDR</GUID1>
</Header>
<Data>
<Order>1</Order>
<Material>Mat1</Material>
</Data>
<Data>
<Order>2</Order>
<Material>Mat2</Material>
</Data>
</ns1:Outbound_Msg1_MT>
</ns0:Message1>
</ns0:Messages>
Result
<ns0:Message1>
<ns1:Inbound_Msg1_MT xmlns:ns1="http://Test/Test">
<Header>
<GUID1>HDR</GUID1>
</Header>
<Data>
<Order>1</Order>
<Material>Mat1</Material>
</Data>
</ns1:Inbound_Msg1_MT>
</ns0:Message1>
</ns0:Messages>
Mapping
Inbound_Msg1_MT
Material>removeContexts>sort>SplitByValue(Value Change)>Inbound_Msg1_MT
Header
Material>removeContexts>sort>SplitByValue(Value Change)>Header
GUID1
Material>removeContexts->useOneAsMany>SplitByValue(Each value)-->GUID1
Data
Data>removeContexts>formatByExample(1)
Material>removeContexts>sort>SplitByValue(Value Change)>formatByExample(2)
formatByExample-->Data
Order
Material>removeContexts>SortByKey(1)
Order>removeContexts>SortByKey(2)
SortByKey-->formatByExample(1)
Material>removeContexts>sort>SplitByValue(Each value)>formatByExample(2)
formatByExample->Order
Material
Material>removeContexts>sort>SplitByValue (EachValue)>Material
Hi,
As per your requirement, I think you can use format by example, use one as many and split functions.
example:
FormatByExample
1.>Order(Change the context to header)
2.>Material
Then the target structure will be:
<Data>
<Order>50000890</order>
<order>50000892</order>
<Material>MAT1</material>
</Data>
Now Split By Value Change
Target will be:
<Data>
<Order>50000890</order>
<Material>MAT1</material>
</Data>
<Data>
<order>50000892</order>
<Material>MAT1</material>
</Data>
Edited by: nutan champia on Dec 30, 2009 10:10 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looks like you are using the same message type used for source and as a result you may not be able to modify the occurence..
if you are trying to change the occurence of same message then better create the anoter messsage type for target and change the occurence...also you can go to message mapping last tab and change the occurence of the same....
HTH
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi RodneyH
The requirement which you have is same as is given in TBIT 41
If you do have TBIT 41 then there is one exercise named Exercise 3: Advanced Message Mapping
go through this exercise this contains UDF code also and same requirement as you required.
regards
sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
26 | |
9 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.