<?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>topic Re: Alphanumeric Sorting in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236995#M772495</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bapul&lt;/P&gt;&lt;P&gt;I think u dint get my requirement&lt;/P&gt;&lt;P&gt;i want values to be ascending&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like this&lt;/P&gt;&lt;P&gt;since normal sorting is based on string comparison it is sorting like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A8 is considerd as higher value since A8 is compared with A1 first.&lt;/P&gt;&lt;P&gt;hop u understood&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Jan 2008 07:15:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-09T07:15:44Z</dc:date>
    <item>
      <title>Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236988#M772488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi..&lt;/P&gt;&lt;P&gt;I need to sort projects in an internal table.&lt;/P&gt;&lt;P&gt;project(PROJ-PSPID).&lt;/P&gt;&lt;P&gt;Suppose that in one internal table t_proj we have three entries&lt;/P&gt;&lt;P&gt;EC-000293-A8 &lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Afther sorting ascending the ouput will be&lt;/P&gt;&lt;P&gt;SORT t_proj Ascending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;But my required output shoud be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone pls help me in sorting like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sheeba Bhaskaran on Jan 9, 2008 12:15 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sheeba Bhaskaran on Jan 9, 2008 12:16 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 06:44:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236988#M772488</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T06:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236989#M772489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SORT t_proj Descending.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;awrd points if helpful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bhupal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 06:48:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236989#M772489</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T06:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236990#M772490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The field which u r sorting is Character , so it will do the same as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT t_proj Ascending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To over come this, try to move this field to NUMC type.&lt;/P&gt;&lt;P&gt;It cant be moved directly , u can use WRITE ..TO   statement.&lt;/P&gt;&lt;P&gt;and do sorting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Revrt back if still not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;naveen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Naveen Deva on Jan 9, 2008 7:51 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 06:49:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236990#M772490</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T06:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236991#M772491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sheeba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TableSorter.java code is here.&lt;/P&gt;&lt;P&gt;create a java file in ur WD project in ur pacakages folder. let it be in subfolde 'com' of ur project's packages folder.&lt;/P&gt;&lt;P&gt;then code is&lt;/P&gt;&lt;P&gt;code&lt;/P&gt;&lt;P&gt;package com;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import java.sql.Date;&lt;/P&gt;&lt;P&gt;import java.text.Collator;&lt;/P&gt;&lt;P&gt;import java.util.ArrayList;&lt;/P&gt;&lt;P&gt;import java.util.Collection;&lt;/P&gt;&lt;P&gt;import java.util.Comparator;&lt;/P&gt;&lt;P&gt;import java.util.HashMap;&lt;/P&gt;&lt;P&gt;import java.util.Iterator;&lt;/P&gt;&lt;P&gt;import java.util.Map;&lt;/P&gt;&lt;P&gt;import java.util.StringTokenizer;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByIndex;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByKey;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractInputField;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractTableColumn;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCheckBox;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDLink;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDProgressIndicator;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDRadioButton;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableCellEditor;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumnGroup;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextEdit;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTableColumnSortDirection;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.progmodel.api.IWDAction;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.progmodel.api.IWDNode;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.progmodel.api.IWDNodeElement;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.progmodel.api.IWDViewElement;&lt;/P&gt;&lt;P&gt;import com.sap.tc.webdynpro.services.sal.localization.api.WDResourceHandler;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Helper class that makes a Web Dynpro table UI element sortable (column-wise).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public final class TableSorter {&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@param table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@param sortAction&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@param comparators&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a table sorter for the given table using the given sort action.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This constructor must be called from &amp;lt;code&amp;gt;wdDoModifyView()&amp;lt;/code&amp;gt;, but&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;usually only when that hook is called for the first time. Store the newly&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;created instance in a context attribute with Java native type&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;code&amp;gt;com.sap.tc.webdynpro.tests.utils.TableSorter&amp;lt;/code&amp;gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The given sort action's event handler will be bound to the &amp;lt;code&amp;gt;onSort&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;event of the table and must at least call this table sorter's&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;code&amp;gt;sort(wdEvent)&amp;lt;/code&amp;gt; method.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Every column of the table is made sortable if possible according to the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;following rules.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If a comparator is given for a column's ID and it is a&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;code&amp;gt;NodeElementByAttributeComparator&amp;lt;/code&amp;gt;, then that comparator defines&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;both the attribute and the ordering used to sort that column.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If any other comparator is given and an attribute can be determined from&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;that column's table cell editor, then that attribute is used to sort that&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;column according to the ordering imposed by the given comparator.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If no comparator is given but an attribute can be determined from&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;that column's table cell editor, then that attribute is used to sort that&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;column according to the natural ordering of that attribute's type.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Else that column is left untouched.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Additionally it is possible to define the sortable columns by their &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TableColumn UI element ids.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see sort()&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see NodeElementByAttributeComparator&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public TableSorter(IWDTable table, IWDAction sortAction, Map comparators) {&lt;/P&gt;&lt;P&gt;init(table, sortAction, comparators, null);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public TableSorter(IWDTable table, IWDAction sortAction, Map comparators, String[] sortableColumns) {&lt;/P&gt;&lt;P&gt;init(table, sortAction, comparators, sortableColumns);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Initialisation stuff&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private void init(IWDTable table, IWDAction sortAction, Map comparators, String[] sortableColumns){&lt;/P&gt;&lt;P&gt;this.table = table;&lt;/P&gt;&lt;P&gt;if(sortableColumns == null){&lt;/P&gt;&lt;P&gt;sortableCols = null;&lt;/P&gt;&lt;P&gt;}else{&lt;/P&gt;&lt;P&gt;sortableCols = new HashMap();&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; sortableColumns.length; i++) {&lt;/P&gt;&lt;P&gt;sortableCols.put(sortableColumns, sortableColumns);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// sanity checks&lt;/P&gt;&lt;P&gt;if (sortAction == null)&lt;/P&gt;&lt;P&gt;throw new IllegalArgumentException("Sort action must be given");&lt;/P&gt;&lt;P&gt;if (table == null)&lt;/P&gt;&lt;P&gt;throw new IllegalArgumentException("Table must be given");&lt;/P&gt;&lt;P&gt;if (table.bindingOfDataSource() == null)&lt;/P&gt;&lt;P&gt;throw new IllegalArgumentException(&lt;/P&gt;&lt;P&gt;"Data source of table with id '" + table.getId() + "' must be bound");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// make the columns sortable&lt;/P&gt;&lt;P&gt;String dataSourcePrefix = table.bindingOfDataSource() + ".";&lt;/P&gt;&lt;P&gt;//TODO: remove the following line since this method is not longer available in later releases&lt;/P&gt;&lt;P&gt;setComparatorsForColumns(dataSourcePrefix, table.iterateColumns(), comparators);&lt;/P&gt;&lt;P&gt;setComparatorsForColumns(dataSourcePrefix, table.iterateGroupedColumns(), comparators);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//set up the table properties&lt;/P&gt;&lt;P&gt;table.setOnSort(sortAction);&lt;/P&gt;&lt;P&gt;table.mappingOfOnSort().addSourceMapping(IWDTable.IWDOnSort.COL, "selectedColumn");&lt;/P&gt;&lt;P&gt;table.mappingOfOnSort().addSourceMapping(IWDTable.IWDOnSort.DIRECTION, "sortDirection"); &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Try to make the given columns sortable (recusivly, if necessary)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private void setComparatorsForColumns(String dataSourcePrefix, Iterator columnIterator, Map comparators){&lt;/P&gt;&lt;P&gt;int index = 0;&lt;/P&gt;&lt;P&gt;for (Iterator it = columnIterator; it.hasNext(); ++index) { // for every column: try to make it bindable&lt;/P&gt;&lt;P&gt;IWDAbstractTableColumn abstractColumn = (IWDAbstractTableColumn) it.next();&lt;/P&gt;&lt;P&gt;if(abstractColumn instanceof IWDTableColumn){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IWDTableColumn column = (IWDTableColumn)abstractColumn;&lt;/P&gt;&lt;P&gt;if(sortableCols == null || sortableCols.containsKey(column.getId())){&lt;/P&gt;&lt;P&gt;//try to make this column sortable&lt;/P&gt;&lt;P&gt;Comparator comparator = null;&lt;/P&gt;&lt;P&gt;if (comparators != null){&lt;/P&gt;&lt;P&gt;comparator = (Comparator)comparators.get(column.getId());&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NodeElementByAttributeComparator elementComparator = null; &lt;/P&gt;&lt;P&gt;if (comparator instanceof NodeElementByAttributeComparator) {&lt;/P&gt;&lt;P&gt;// the easy one, attribute and ordering are given&lt;/P&gt;&lt;P&gt;elementComparator = (NodeElementByAttributeComparator)comparator;&lt;/P&gt;&lt;P&gt;} else { // attribute must be determined&lt;/P&gt;&lt;P&gt;String bindingOfPrimaryProperty = bindingOfPrimaryProperty(column.getTableCellEditor());&lt;/P&gt;&lt;P&gt;if (bindingOfPrimaryProperty == null || !bindingOfPrimaryProperty.startsWith(dataSourcePrefix)){&lt;/P&gt;&lt;P&gt;//no attribute found or outside of data source&lt;/P&gt;&lt;P&gt;column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);&lt;/P&gt;&lt;P&gt;continue;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;String attributeName = bindingOfPrimaryProperty.substring(dataSourcePrefix.length());&lt;/P&gt;&lt;P&gt;Collection subnodes = new ArrayList();&lt;/P&gt;&lt;P&gt;if (attributeName.indexOf('.') &amp;gt;= 0){&lt;/P&gt;&lt;P&gt;//attribute not immediately below data source&lt;/P&gt;&lt;P&gt;String[] tokens = tokenize (attributeName, ".");&lt;/P&gt;&lt;P&gt;for(int i=0; i&amp;lt;tokens.length-1; i++){&lt;/P&gt;&lt;P&gt;subnodes.add(tokens);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;attributeName = tokenshttp://tokens.length-1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;if(subnodes.size() == 0){&lt;/P&gt;&lt;P&gt;elementComparator = new NodeElementByAttributeComparator(attributeName, comparator);&lt;/P&gt;&lt;P&gt;}else{&lt;/P&gt;&lt;P&gt;elementComparator = new NodeElementByAttributeComparator(attributeName, comparator, subnodes);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// set up internal data structures&lt;/P&gt;&lt;P&gt;comparatorForColumn.put(column, elementComparator);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//set sort state&lt;/P&gt;&lt;P&gt;column.setSortState(WDTableColumnSortDirection.NONE);&lt;/P&gt;&lt;P&gt;}else{&lt;/P&gt;&lt;P&gt;//column should not be sortable&lt;/P&gt;&lt;P&gt;column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}else if (abstractColumn instanceof IWDTableColumnGroup){&lt;/P&gt;&lt;P&gt;//it's just a column group -&amp;gt; try to bind the columns of the column group&lt;/P&gt;&lt;P&gt;IWDTableColumnGroup columnGroup = (IWDTableColumnGroup)abstractColumn;&lt;/P&gt;&lt;P&gt;setComparatorsForColumns(dataSourcePrefix, columnGroup.iterateColumns(), comparators);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Tokenizes the input string according to the given delimiters. The delimiters will be left out.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Example: tokenize("Hello_World", "_") results \"Hello\", \"World\"&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private String[] tokenize (String input, String delim){&lt;/P&gt;&lt;P&gt;StringTokenizer tokenizer = new StringTokenizer(input, delim);&lt;/P&gt;&lt;P&gt;String[] tokens = new Stringhttp://tokenizer.countTokens();&lt;/P&gt;&lt;P&gt;int index = 0;&lt;/P&gt;&lt;P&gt;while(tokenizer.hasMoreTokens()){&lt;/P&gt;&lt;P&gt;tokensindex = tokenizer.nextToken();&lt;/P&gt;&lt;P&gt;index++;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return tokens;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This method must be called from the event handler of this table sorter's&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sort action. It performs the actual sort operation.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public void sort(IWDCustomEvent wdEvent, IWDNode dataSource) {&lt;/P&gt;&lt;P&gt;// find the things we need&lt;/P&gt;&lt;P&gt;String columnId = wdEvent.getString("selectedColumn");&lt;/P&gt;&lt;P&gt;String direction = wdEvent.getString("sortDirection");&lt;/P&gt;&lt;P&gt;IWDTableColumn column = (IWDTableColumn) table.getView().getElement(columnId);&lt;/P&gt;&lt;P&gt;NodeElementByAttributeComparator elementComparator = (NodeElementByAttributeComparator) comparatorForColumn.get(column);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (elementComparator == null){&lt;/P&gt;&lt;P&gt;//not a sortable column&lt;/P&gt;&lt;P&gt;column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);&lt;/P&gt;&lt;P&gt;return; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// sorting&lt;/P&gt;&lt;P&gt;elementComparator.setSortDirection(WDTableColumnSortDirection.valueOf(direction));&lt;/P&gt;&lt;P&gt;dataSource.sortElements(elementComparator);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Returns the binding of the given table cell editor's property that is&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;considered "primary" or &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; if no such binding exists or no&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;such property can be determined.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private static final String bindingOfPrimaryProperty(IWDTableCellEditor editor) {&lt;/P&gt;&lt;P&gt;return editor instanceof IWDViewElement ? bindingOfPrimaryProperty((IWDViewElement) editor) : null;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Returns the binding of the given view element's property that is&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;considered "primary" or &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; if no such binding exists or no&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;such property can be determined.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private static final String bindingOfPrimaryProperty(IWDViewElement element) {&lt;/P&gt;&lt;P&gt;if (element instanceof IWDAbstractDropDownByIndex)&lt;/P&gt;&lt;P&gt;return ((IWDAbstractDropDownByIndex) element).bindingOfTexts();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDAbstractDropDownByKey)&lt;/P&gt;&lt;P&gt;return ((IWDAbstractDropDownByKey) element).bindingOfSelectedKey();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDAbstractInputField)&lt;/P&gt;&lt;P&gt;return ((IWDAbstractInputField) element).bindingOfValue();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDCaption)&lt;/P&gt;&lt;P&gt;return ((IWDCaption) element).bindingOfText();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDCheckBox)&lt;/P&gt;&lt;P&gt;return ((IWDCheckBox) element).bindingOfChecked();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDLink)&lt;/P&gt;&lt;P&gt;return ((IWDLink) element).bindingOfText();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDProgressIndicator)&lt;/P&gt;&lt;P&gt;return ((IWDProgressIndicator) element).bindingOfPercentValue();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDRadioButton)&lt;/P&gt;&lt;P&gt;return ((IWDRadioButton) element).bindingOfSelectedKey();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDTextEdit)&lt;/P&gt;&lt;P&gt;return ((IWDTextEdit) element).bindingOfValue();&lt;/P&gt;&lt;P&gt;if (element instanceof IWDTextView)&lt;/P&gt;&lt;P&gt;return ((IWDTextView) element).bindingOfText();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;return null;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Instance of a comparator according to the ordering imposed by the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;implementation of &amp;lt;code&amp;gt;Comparable&amp;lt;/code&amp;gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private static final Comparator DEFAULT = new Comparator() {&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Compares the given objects according to the ordering imposed by the first&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ones &amp;lt;code&amp;gt;compareTo(Object)&amp;lt;/code&amp;gt; function. Furthermore, &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is treated to be less than any object.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see java.lang.Comparable#compareTo(java.lang.Object)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see java.util.Comparator#compare(java.lang.Object, java.lang.Object)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public int compare(Object o1, Object o2) {&lt;/P&gt;&lt;P&gt;if (o1 == null &amp;amp;&amp;amp; o2 == null)&lt;/P&gt;&lt;P&gt;return 0;&lt;/P&gt;&lt;P&gt;if (o1 == null)&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;if (o2 == null)&lt;/P&gt;&lt;P&gt;return +1;&lt;/P&gt;&lt;P&gt;if (o1 instanceof Boolean &amp;amp;&amp;amp; o2 instanceof Boolean)&lt;/P&gt;&lt;P&gt;return o1.toString().compareTo(o2.toString()); // false &amp;lt; true&lt;/P&gt;&lt;P&gt;if (o1 instanceof String &amp;amp;&amp;amp; o2 instanceof String){&lt;/P&gt;&lt;P&gt;//Use a Collator for sorting according to the given Locale&lt;/P&gt;&lt;P&gt;Collator collate = Collator.getInstance(WDResourceHandler.getCurrentSessionLocale());&lt;/P&gt;&lt;P&gt;return collate.compare(o1, o2); &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return ((Comparable) o1).compareTo((Comparable) o2);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Map of table column to comparator (&amp;lt;code&amp;gt;ReversableComparator&amp;lt;/code&amp;gt;)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;used for sorting that column (sortable columns only).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private Map comparatorForColumn = new HashMap();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The table to be sorted.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private IWDTable table = null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Column-IDs of the columns, which should be sortable&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private Map sortableCols = null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Generic comparator that compares node elements by a given attribute with&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the help of a given comparator.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public final class NodeElementByAttributeComparator implements Comparator {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a new comparator for the given attribute name that compares values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of that attribute according to the natural ordering of that attribute's&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;type (which must implement &amp;lt;code&amp;gt;java.lang.Comparable&amp;lt;/code&amp;gt;).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public NodeElementByAttributeComparator(String attributeName) {&lt;/P&gt;&lt;P&gt;this(attributeName, null, false, new ArrayList());&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a new comparator for the given attribute name that compares values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of that attribute with the help of the given comparator. If no comparator&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is given, the natural ordering of that attribute's type is used.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public NodeElementByAttributeComparator(String attributeName, Comparator comparator) {&lt;/P&gt;&lt;P&gt;this(attributeName, comparator, false, new ArrayList());&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a new comparator for the given attribute name that compares values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of that attribute either as objects (i.e. "in internal format") or as text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(i.e. "in external format") as indicated. The ordering is the natural&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ordering of that attribute's type (which must implement&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;code&amp;gt;java.lang.Comparable&amp;lt;/code&amp;gt;) in case objects are compared or the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;natural ordering of &amp;lt;code&amp;gt;java.lang.String&amp;lt;/code&amp;gt; in case texts are compared.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public NodeElementByAttributeComparator(String attributeName, boolean compareAsText) {&lt;/P&gt;&lt;P&gt;this(attributeName, null, compareAsText, new ArrayList());&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a new comparator for the given attribute name that compares values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of that attribute according to the natural ordering of that attribute's&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;type (which must implement &amp;lt;code&amp;gt;java.lang.Comparable&amp;lt;/code&amp;gt;). In addition it is possible &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;to define the path to a child node with the &amp;lt;code&amp;gt;java.util.Collection&amp;lt;/code&amp;gt; subnodes.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(List of child node names in the correct order)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public NodeElementByAttributeComparator(String attributeName, Collection subnodes) {&lt;/P&gt;&lt;P&gt;this(attributeName, null, false, subnodes);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a new comparator for the given attribute name that compares values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of that attribute with the help of the given comparator. If no comparator&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is given, the natural ordering of that attribute's type is used. In addition it is possible &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;to define the path to a child node with the &amp;lt;code&amp;gt;java.util.Collection&amp;lt;/code&amp;gt; subnodes.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(List of child node names in the correct order)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public NodeElementByAttributeComparator(String attributeName, Comparator comparator, Collection subnodes) {&lt;/P&gt;&lt;P&gt;this(attributeName, comparator, false, subnodes);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creates a new comparator for the given attribute name that compares values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of that attribute either as objects (i.e. "in internal format") or as text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(i.e. "in external format") as indicated. The ordering is the natural&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ordering of that attribute's type (which must implement&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;code&amp;gt;java.lang.Comparable&amp;lt;/code&amp;gt;) in case objects are compared or the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;natural ordering of &amp;lt;code&amp;gt;java.lang.String&amp;lt;/code&amp;gt; in case texts are compared. In addition it is possible &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;to define the path to a child node with the &amp;lt;code&amp;gt;java.util.Collection&amp;lt;/code&amp;gt; subnodes.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(List of child node names in the correct order)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public NodeElementByAttributeComparator(String attributeName, boolean compareAsText, Collection subnodes) {&lt;/P&gt;&lt;P&gt;this(attributeName, null, compareAsText, subnodes);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal constructor.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private NodeElementByAttributeComparator(&lt;/P&gt;&lt;P&gt;String attributeName,&lt;/P&gt;&lt;P&gt;Comparator comparator,&lt;/P&gt;&lt;P&gt;boolean compareAsText,&lt;/P&gt;&lt;P&gt;Collection subNodes) {&lt;/P&gt;&lt;P&gt;if (attributeName == null)&lt;/P&gt;&lt;P&gt;throw new IllegalArgumentException("Attribute name must not be null");&lt;/P&gt;&lt;P&gt;if (comparator == null)&lt;/P&gt;&lt;P&gt;comparator = DEFAULT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this.attributeName = attributeName;&lt;/P&gt;&lt;P&gt;this.comparator = comparator;&lt;/P&gt;&lt;P&gt;this.compareAsText = compareAsText;&lt;/P&gt;&lt;P&gt;this.sortDirection = true;&lt;/P&gt;&lt;P&gt;this.subNodes = subNodes;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sets the sort direction of this comparator to the given direction. The comparator sort in ascending order by default.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTableColumnSortDirection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public void setSortDirection(WDTableColumnSortDirection direction){&lt;/P&gt;&lt;P&gt;if(direction.equals(WDTableColumnSortDirection.UP)){&lt;/P&gt;&lt;P&gt;sortDirection = true;&lt;/P&gt;&lt;P&gt;}else if(direction.equals(WDTableColumnSortDirection.DOWN)){&lt;/P&gt;&lt;P&gt;sortDirection = false;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Compares the given objects which must be instances of &amp;lt;code&amp;gt;IWDNodeElement&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;according to the values of the attribute given at construction time&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;with the help of the comparator given at construction time.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see java.util.Comparator#compare(java.lang.Object, java.lang.Object)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;@see com.sap.tc.webdynpro.progmodel.api.IWDNodeElement&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;public int compare(Object o1, Object o2) {&lt;/P&gt;&lt;P&gt;IWDNodeElement element1 = (IWDNodeElement) o1;&lt;/P&gt;&lt;P&gt;IWDNodeElement element2 = (IWDNodeElement) o2;&lt;/P&gt;&lt;P&gt;if(subNodes.size() &amp;gt; 0){&lt;/P&gt;&lt;P&gt;element1 = getSubNodeElement(element1, 0);&lt;/P&gt;&lt;P&gt;element2 = getSubNodeElement(element2, 0);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Object attributeValue1 = null;&lt;/P&gt;&lt;P&gt;Object attributeValue2 = null;&lt;/P&gt;&lt;P&gt;if(element1 != null){&lt;/P&gt;&lt;P&gt;attributeValue1 =&lt;/P&gt;&lt;P&gt;compareAsText&lt;/P&gt;&lt;P&gt;? element1.getAttributeAsText(attributeName)&lt;/P&gt;&lt;P&gt;: element1.getAttributeValue(attributeName);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;if(element2 != null){&lt;/P&gt;&lt;P&gt;attributeValue2 =&lt;/P&gt;&lt;P&gt;compareAsText&lt;/P&gt;&lt;P&gt;? element2.getAttributeAsText(attributeName)&lt;/P&gt;&lt;P&gt;: element2.getAttributeValue(attributeName);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(sortDirection){&lt;/P&gt;&lt;P&gt;return comparator.compare(attributeValue1, attributeValue2);&lt;/P&gt;&lt;P&gt;}else{&lt;/P&gt;&lt;P&gt;return comparator.compare(attributeValue2, attributeValue1);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Determines recursivly the child node, which have an attribute with the given name.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The path to this child node must be specified in the subnodes property of this comparator.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start this method with index = 0.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private IWDNodeElement getSubNodeElement(IWDNodeElement currentElement, int index){&lt;/P&gt;&lt;P&gt;if(currentElement == null || index &amp;gt;= subNodes.size()){&lt;/P&gt;&lt;P&gt;//end of recursion&lt;/P&gt;&lt;P&gt;return currentElement;&lt;/P&gt;&lt;P&gt;}else{&lt;/P&gt;&lt;P&gt;return getSubNodeElement(currentElement.node().getChildNode((String)subNodes.toArray()index, currentElement.index()).getCurrentElement(), index+1);&lt;/P&gt;&lt;P&gt;//return getSubNodeElement(currentElement.node().getChildNode((String)subNodes.toArray()index, currentElement.index()).getElementAt(0), index+1);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Name of the attribute used for comparisons.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private final String attributeName;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Comparator used for comparing the attribute's values.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private final Comparator comparator;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Indicates whether attribute values are compared as text (as opposed to&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;"as objects").&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private final boolean compareAsText;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sort direction (true = ascending order, false = descending order)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private boolean sortDirection;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;List of child node names&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(Description of the path from the given context node to the specified attribute)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;private Collection subNodes;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Hema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 06:52:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236991#M772491</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T06:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236992#M772492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Define new internal table with 4 fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at your table and split values in new internal table as &lt;/P&gt;&lt;P&gt;field1  field2    field3&lt;/P&gt;&lt;P&gt;EC     000293 A8 &lt;/P&gt;&lt;P&gt;EC     000293 A17&lt;/P&gt;&lt;P&gt;EC     000293 A15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort new internal table by field1 field2 field3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4th field will be same as old internal table filed.&lt;/P&gt;&lt;P&gt;loop at new internal table.&lt;/P&gt;&lt;P&gt;concatenate field1 field2 field3 seperated by '-'.&lt;/P&gt;&lt;P&gt;condense 4th field.&lt;/P&gt;&lt;P&gt;modify.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4th field in new internal table will be sorted as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:02:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236992#M772492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236993#M772493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Naveen..&lt;/P&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;Project is alphanumeric string..&lt;/P&gt;&lt;P&gt;then how is it possible to move it to a numeric type.?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sheeba&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:02:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236993#M772493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236994#M772494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;U sort ur itab by this field Descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;awrd points if useful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bhupal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:05:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236994#M772494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236995#M772495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bapul&lt;/P&gt;&lt;P&gt;I think u dint get my requirement&lt;/P&gt;&lt;P&gt;i want values to be ascending&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like this&lt;/P&gt;&lt;P&gt;since normal sorting is based on string comparison it is sorting like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EC-000293-A15&lt;/P&gt;&lt;P&gt;EC-000293-A17&lt;/P&gt;&lt;P&gt;EC-000293-A8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A8 is considerd as higher value since A8 is compared with A1 first.&lt;/P&gt;&lt;P&gt;hop u understood&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:15:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236995#M772495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236996#M772496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Little modification in logic i have give above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field1                 field2 &lt;/P&gt;&lt;P&gt;EC-000293-A        8 &lt;/P&gt;&lt;P&gt;EC-000293-A       17&lt;/P&gt;&lt;P&gt;EC-000293-A       15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In new internal table you can just define 2 field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort new internal table by field1 and field2 (basically this will seperate characters and numbers)..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can simply concatenate them in new field to get your required sorting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:23:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236996#M772496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236997#M772497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mohaiyuddin,&lt;/P&gt;&lt;P&gt;But i can have projects in any format not neccesarly &lt;/P&gt;&lt;P&gt;EC-000293-A 8 &lt;/P&gt;&lt;P&gt;it can be&lt;/P&gt;&lt;P&gt;EC-000293-AB12C&lt;/P&gt;&lt;P&gt;EC-000293-A12&lt;/P&gt;&lt;P&gt;EC-000293-B43C&lt;/P&gt;&lt;P&gt;EC-000293-AABC12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so it will be a problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236997#M772497</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236998#M772498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sheeba&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope below code can help you understand in handling your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
types: begin of t_proj,
         pspid type ps_pspid,
         len  type i,
       end of t_proj.

data: i_proj type standard table of t_proj,
      wa_proj type t_proj.

start-of-selection.

perform append_data using: 'EC-000293-A8',
                           'EC-000293-A17',
                           'EC-000293-A15'.

sort i_proj by len pspid.

loop at i_proj into wa_proj.
   write:/ wa_proj-pspid.
endloop.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  APPEND_DATA
*&amp;amp;---------------------------------------------------------------------*
form APPEND_DATA  using    p_proj type ps_pspid.

  clear: wa_proj.
  wa_proj-pspid = p_proj.
  wa_proj-len   = strlen( p_proj ).
  append wa_proj to i_proj.

endform.                    " APPEND_DATA
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 07:56:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236998#M772498</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T07:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236999#M772499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sheeba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case, i don't think there is direct way to doing it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;splitting in single character after common pattern can be only option, but that will be too complex as that will also require logic to sort - will not be able to use sort directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 08:00:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3236999#M772499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T08:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Alphanumeric Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3237000#M772500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Eswar...&lt;/P&gt;&lt;P&gt;Points given...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 05:07:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alphanumeric-sorting/m-p/3237000#M772500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T05:07:31Z</dc:date>
    </item>
  </channel>
</rss>

