on ‎2007 Jul 04 6:10 AM
Hi SDNers,
My requirement is File - XI - R/3 (IDOC). Before processing the file, it should be sorted out based on a particular field.
Eg. The input file may have this pattern. I need to sort the file based on second field.
D,5601,Jai,Caritor
D,5000,Raj,Caritor
D,7000,Albert,Caritor
Records after sorting
D,5000,Raj,Caritor
D,5601,Jai,Caritor
D,7000,Albert,Caritor
I tried the following way. Read the whole record as a node, so there are 3 nodes for the above example. With in adapter module, retrieve all records and based on the second field sort and then construct the XML with each record containing all 4 fields. I am using DOM parser for this.
Issue: My actual input file has 27 fields and the size of the file is expected around 2 to 20 MB. It is really diffucult to construct the output XML. Is there any other alternative or a better way to handle such scenario?
Share your ideas.
Thank You.
Regards,
Jai Shankar
Request clarification before answering.
Jai,
Why not use simple content conversion and then use the Sort option in message mapping?
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bhavesh,
I cant use the sort function with in Mapping. Reason is it will sort the particular field, but I need the whole record to be sorted before the mapping can occur.
@Amol,
Will look into the SAX option and try to use the data structures like Vectors.
Thanks a lot for the ideas. If there is any thing else that I can look into kindly let me know.
Regards,
Jai Shankar
Bhavesh,
I would expect the target XML for the above example as
<Record>
<Id>5000</Id>
<Name>Raj</Name>
<COmpany>Caritor</Company>
</Record>
<Record>
<Id>5601</Id>
<Name>Jai</Name>
<COmpany>Caritor</Company>
</Record>
<Record>
<Id>7000</Id>
<Name>Albert</Name>
<COmpany>Caritor</Company>
</Record>Not just sorted values for <Id> fields. I tried with sort for Id field. It did not work out.
Am I missing some thing here?
Regards,
Jai Shankar
Jai,
This is what I did,
<b>Target Record Mapping :</b>
Id --> Context of Root Node --> Sort --> Record
<b>ID Mapping</b>
Id ---
SORTBYKEY ---SPLITBYVALU --> ID
Id -- --
<b>Name Mapping</b>
Id
SORTBYKEY ---SPLITBYVALU --> Name
Name
Likewise for Company.Tried it and this works
Regards
Bhavesh
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.