on 12-29-2011 11:23 AM
My scenario is Web Service to Idoc and I created everything in ESR and id part and configuration steps but stuck in mapping level
Here my Source Structure(example):
<MT_INPUT>
<Header>
<Vendor>XXXX</Vendor>
</Header>
<Records>
<Item>
<POSNR>10</POSNR>
<TYPE>T</TYPE>
<AMOUNT>100</AMOUNT>
</Item>
</Records>
<Records>
<Item>
<POSNR>20</POSNR>
<TYPE>G</TYPE>
<AMOUNT>200</AMOUNT>
</Item>
</Records>
<Records>
<Item>
<POSNR>30</POSNR>
<TYPE>G</TYPE>
<AMOUNT>300</AMOUNT>
</Item>
</Records>
<Records>
<Item>
<POSNR>40</POSNR>
<TYPE>T</TYPE>
<AMOUNT>400</AMOUNT>
</Item>
</Records>
</MT_INPUT>
<MT_OUTPUT>
<Header>
<VendorName>XXXX</VendorName>
</Header>
<TYPE_T>
<ITEM>
<POSNR>10</POSNR>
<TYPE>T</TYPE>
<AMOUNT>100</AMOUNT>
</ITEM>
<ITEM>
<POSNR>40</POSNR>
<TYPE>T</TYPE>
<AMOUNT>400</AMOUNT>
</ITEM>
</TYPE_T>
<TYPE_S>
<POSNR>20</POSNR>
<TYPE>S</TYPE>
</TYPE_S>
<TYPE_G>
<POSNR>30</POSNR>
<TYPE>G</TYPE>
</TYPE_G>
</MT_OUTPUT>
On the target side i need to collect items with type = t in TYPE_T Segment and take over the Amount values.
In another types amount shouldnt be created.
Could you please tell me how to map this?
thanks
PM
Edited by: Prateek Raj Srivastava on Dec 29, 2011 11:46 PM
Hi peter,
You can use this UDF for select the value with one qualifier.
public void GetQualf(String[] qualf, String[] value, String qualfID, ResultList result, Container container) throws StreamTransformationException{
boolean found = false;
int i;
for(i=0;i<qualf.length && !found;i++){
found = qualf<i>.equals(qualfID);
}
if(found)
result.addValue(value[i-1]);
else
result.addValue("");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved with XSLT mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
try with the below mapping..and please let me if it is not working.
type>removecontext>sort>splitByvaluechange>if type equals t>create if> Item
sortBykey>formatByExample>POSNR
sortByKey:
input1:type-->removecontext
input2:posnr-->removeContext
FormatByExample:
input1:resultOfSortByKey
input2:type>removecontext>sort-->splitByEachValue
type>removecontext>sort>splitByEachValue>Type
type>removecontext>sort>splitbyvaluechange>if equals T > then pass result of formatByexample>Amount
formatByexample:
input1:result of sortby key
input2:type>removecontext>sort-->splitByEachValue
SortBykey:
input1:type-->removecontext
input2:amount-->removecontext
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(0)-->TYPE_G
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(1)-->TYPE_S
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(2)-->TYPE_T
Regards,
Priyanka
Hi Peter,
Hope it should work surely.....please try it once again & let me know where you're strucking.
Are you able to create the TYPE_T,G,S nodes and item nodes successfully? First map the other elements with constant and check whether you are getting the required no.of nodes or not and then map the elements.
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(0)-->TYPE_G
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(1)-->TYPE_S
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(2)-->TYPE_T
type>removecontext>sort>splitByvaluechange>if equals constant T>create if> Item
sortBykey>formatByExample>POSNR
sortByKey:
input1:type-->removecontext
input2:posnr-->removeContext
FormatByExample:
input1:resultOfSortByKey
input2:type>removecontext>sort-->splitByEachValue
type>removecontext>sort>splitByEachValue>Type
type>removecontext>sort>splitbyvaluechange>if equals constant T > then pass result of formatByexample>Amount
formatByexample:
input1:result of sortby key
input2:type>removecontext>sort-->splitByValueChange
SortBykey:
input1:type-->removecontext
input2:amount-->removecontext
Regards,
Priyanka
Edited by: priyanka.anagani on Dec 29, 2011 6:21 PM
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
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.