on 11-26-2008 5:37 PM
Hi. I am relatively new to XI and have a mapping problem that I have been struggling with all day.
I have a field SOinErr within an unbounded message that I need to concatenate into a field within a bounded message
(Content). I am OK with writing a udf to append the fields but I'm not sure how to iterate through each instance of SOinErr.
We have XI 7.0 SP13.
Input: -
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
- <ns0:Message1>
- <ns1:MT_AllSalesOrderNumber xmlns:ns1="http://royalmail.com/RM_ORDERS_CONTINUITY">
- <All_SO_Numbers>
<SOinErr />
<Err_Msg />
<SOnoErr>500</SOnoErr>
</All_SO_Numbers>
- <All_SO_Numbers>
<SOinErr />
<Err_Msg />
<SOnoErr>600</SOnoErr>
</All_SO_Numbers>
- <All_SO_Numbers>
<SOinErr />
<Err_Msg />
<SOnoErr>700</SOnoErr>
</All_SO_Numbers>
</ns1:MT_AllSalesOrderNumber>
</ns0:Message1>
- <ns0:Message2>
- <ns1:MT_OrderContinuity xmlns:ns1="http://royalmail.com/RM_ORDERS_CONTINUITY">
- <DT_OrderContinuity>
<CustomerAccountNumber />
<ServiceRegister />
<ServiceLevel />
<Weight />
<ItemCount />
<BagCount />
<Class />
<Format />
<Sortation />
<Submission />
<OCRIndicator />
<FrankingIndicator />
<FrankingSurcharge />
<ZoneIdentifier />
<CountryIdentifier />
<Residues />
<Region />
<SingleWtUsed1 />
<ConsignmentReferenceNumber />
<Department />
<YourReference />
<Fees />
<IssueID />
<MagazineCode />
<BookingRefNumber />
<MAPRefNumber />
<PosterID />
<EMailID />
<YourDescription />
<CustomerReference />
<YourNotes />
<AutoConfirm />
</DT_OrderContinuity>
</ns1:MT_OrderContinuity>
</ns0:Message2>
</ns0:Messages>
Desired Output: -
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
- <ns0:Message1>
- <ns2:Mail xmlns:ns2="http://sap.com/xi/XI/Mail/30">
<From></From>
<To />
<Content_Type>text/plain</Content_Type>
<Content>500 600 700</Content>
</ns2:Mail>
</ns0:Message1>
</ns0:Messages>
Thanks guys, your suggestion works a treat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richard
The solution given above by experts will work
SOinErr --> RemoveContext --> UDF --> Target.
SOinErr can have different instance you can use RemoveContext to get all at same context and then use UDF and cache type queue. SOinErr can be passed as String array you can iterate through the length.
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rechard,
The soulution which Anand is suggested is good.
Create an advanced UDF code and set Cache to queue..
//write your code here
String output = "";
for(int i =0; i < SOnoErr.length; i ++)
{
output = output + SOnoErrr<i> + "";
if ( ! i == SOnoErr.length-1) // this will check the value till 2nd last value
{
output = output + ""; //this will add the space after eache value
}
}
result.addValue(output);
SOnoErr (set the context to root) -
> UDF -
> Content
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if i got it correct, u want all "SOinErr" element values to concat and map this to "Content"
Do the followign..
SOinErr --> RemoveContext --> UDF --> Content
UDF: i am not writing the code as u know to do it..
function( String[] soinErr, ResultList result, Container container)
{
//loop thr all the soinErr and append and add it to result...
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.