<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Sort records before processing in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438582#M1043008</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bhavesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Amol, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Will look into the SAX option and try to use the data structures like Vectors. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for the ideas. If there is any thing else that I can look into kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jul 2007 05:30:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-04T05:30:13Z</dc:date>
    <item>
      <title>Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaq-p/2438579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SDNers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; My requirement is File - XI - R/3 (IDOC). Before processing the file, it should be sorted out based on a particular field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg. The input file may have this pattern. I need to sort the file based on second field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D,5601,Jai,Caritor&lt;/P&gt;&lt;P&gt;D,5000,Raj,Caritor&lt;/P&gt;&lt;P&gt;D,7000,Albert,Caritor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Records after sorting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D,5000,Raj,Caritor&lt;/P&gt;&lt;P&gt;D,5601,Jai,Caritor&lt;/P&gt;&lt;P&gt;D,7000,Albert,Caritor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Share your ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 05:10:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaq-p/2438579</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T05:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438580#M1043006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jai,&lt;/P&gt;&lt;P&gt;Why not use simple content conversion and then use the Sort option in message mapping?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bhavesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 05:19:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438580#M1043006</guid>
      <dc:creator>bhavesh_kantilal</dc:creator>
      <dc:date>2007-07-04T05:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438581#M1043007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;one issue i definately see here is you are using DOM..cant imagine a 20 MB xml being loaded into DOM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest you a change in your approach using SAX...load the contents of your file into a dynamically growing datastructure like vectors...and also put the key field into another datastructure which then you could sort easily...rearrange / copy from the original data strcture to a new datastructure with your own sorting logic which may be looking up for an object with perticular field value(key value)..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 05:23:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438581#M1043007</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T05:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438582#M1043008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bhavesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Amol, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Will look into the SAX option and try to use the data structures like Vectors. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for the ideas. If there is any thing else that I can look into kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 05:30:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438582#M1043008</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T05:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438583#M1043009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wouldnt actually happen with Sort as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Map the Target Node with the Corresponding Sorted Field and the right context, it will work exactly as you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bhavesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 05:32:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438583#M1043009</guid>
      <dc:creator>bhavesh_kantilal</dc:creator>
      <dc:date>2007-07-04T05:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438584#M1043010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bhavesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I would expect the target XML for the above example as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Record&amp;gt;
&amp;lt;Id&amp;gt;5000&amp;lt;/Id&amp;gt;
&amp;lt;Name&amp;gt;Raj&amp;lt;/Name&amp;gt;
&amp;lt;COmpany&amp;gt;Caritor&amp;lt;/Company&amp;gt;
&amp;lt;/Record&amp;gt;
&amp;lt;Record&amp;gt;
&amp;lt;Id&amp;gt;5601&amp;lt;/Id&amp;gt;
&amp;lt;Name&amp;gt;Jai&amp;lt;/Name&amp;gt;
&amp;lt;COmpany&amp;gt;Caritor&amp;lt;/Company&amp;gt;
&amp;lt;/Record&amp;gt;
&amp;lt;Record&amp;gt;
&amp;lt;Id&amp;gt;7000&amp;lt;/Id&amp;gt;
&amp;lt;Name&amp;gt;Albert&amp;lt;/Name&amp;gt;
&amp;lt;COmpany&amp;gt;Caritor&amp;lt;/Company&amp;gt;
&amp;lt;/Record&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not just sorted values for &amp;lt;Id&amp;gt; fields. I tried with sort for Id field. It did not work out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing some thing here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 06:02:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438584#M1043010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T06:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438585#M1043011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jai,&lt;/P&gt;&lt;P&gt;This is what I did,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Target Record Mapping :&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Id --&amp;gt; Context of Root Node --&amp;gt; Sort --&amp;gt; Record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ID Mapping&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Id ---   &lt;/P&gt;&lt;P&gt;              SORTBYKEY ---SPLITBYVALU --&amp;gt; ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Id -- --&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Name Mapping&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Id &lt;/P&gt;&lt;P&gt;              SORTBYKEY ---SPLITBYVALU --&amp;gt; Name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Likewise for Company.Tried it and this works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bhavesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 06:43:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438585#M1043011</guid>
      <dc:creator>bhavesh_kantilal</dc:creator>
      <dc:date>2007-07-04T06:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sort records before processing</title>
      <link>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438586#M1043012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks Bhavesh. This will solve my issue in most cases:-) (except a few where I actually need to group the records based on some conditions rather than a sort for which I will take Amol's advice).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 07:26:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sort-records-before-processing/qaa-p/2438586#M1043012</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T07:26:03Z</dc:date>
    </item>
  </channel>
</rss>

