Sorting FTREE nodes

is there a way to populate a FTREE object such that the nodes are sorted without loss of hierarchy? I read in a note that the "ORDER BY" clause cannot be used. On the other hand, the items are often "shuffled", and it may be hard for the users to retrieve what they are searching.
Is there some alternative way to obtain it (for example, by splitting the building process level-by-level instead of using a single query)?

As Andreas suggested, you can use ORDER SIBLINGS BY in your tree query to order the level 2 and up nodes with a specific order.
Oracle Forms 10g and 9i does support this SQL syntax.
sample:
CONNECT BY PRIOR M.NODE_ID = M.NODE_PARENT
  START WITH M.NODE_PARENT IS NULL
ORDER SIBLINGS BY M.NODE_ORDERTony

Similar Messages

  • Sort the Nodes and remove duplicate nodes

    Hello Experts,
    I have a requirement to sort the nodes based on a key value.
    e.g.
    <Node>
        <Key>2<Key>
        <Value1>name1<Value1>
        <Value2>email1<Value2>
    </Node>
    <Node>
         <Key>1<Key>
         <Value1>name2<Value1>
        <Value2>email2<Value2>
    </Node>
    <Node>
         <Key>2<Key>
         <Value1>name3<Value1>
        <Value2>email3<Value2>
    </Node>
    and the Output should be
    <TNode>
         <Key>1<Key>
         <Value1>name2<Value1>
        <Value2>email2<Value2>
    </TNode>
    <TNode>
         <Key>2<Key>
         <Value1>name3<Value1>
        <Value2>email3<Value2>
    </TNode>
    I tried using SortByKey function for Node i.e.
    Key --> SortByKey , Node --> TNode
    But I dont get sorted value for Value1 and Value2.
    Can anybody give solution for this?
    I have around 25000 records as input and there are around 25 values in structure.
    Please help.
    Thanks in advance,
    Beena.

    Beena,
    Here you go. If it doesn't helps then let me know.
    Mapping.
    http://www.flickr.com/photo_zoom.gne?id=2185600055&size=o
    http://www.flickr.com/photo_zoom.gne?id=2185600049&size=o
    http://www.flickr.com/photo_zoom.gne?id=2185600063&size=o
    http://www.flickr.com/photo_zoom.gne?id=2185600067&size=o
    Results
    http://www.flickr.com/photo_zoom.gne?id=2185600075&size=o

  • Sorting the nodes...

    hi group,
    the tree has root.The top root has multiple nodes in it..say suppose..nearly 100 nodes in it..
    for ex:
    abc
    def
    ghi
    jkl
    mno
    pqr
    stu
    vwx
    xyz
    i want to sort these nodes in btn action means it should sort and at the same time it should fix in the root node with sorting order.
    Any body has idea on it??
    shalini.

    if its a DefaultMutableTreeNode, you can get the children Vector (protected variable) and sort it using the Arrays utility class. i think it has a vector or object array sorting method in which you can specify the comparator.
    it might be more useful to override the add() method of your node so that when a node is added, you sort the children so the user never has to explicitly do it.

  • Sorting the nodes of a JTree

    Can anyone tell me how to go about sorting the nodes in a JTree?

    The best way to do it is thru the treemodel. Either adjust the order in a DefaultTreeModel, or create your own TreeModel.

  • How to sort Jtree node?

    Now, I want to sort tree node by increasing.
    for example there are three child node:
    [20 -40][
    10 - 20]
    [30- 60].
    they are added to JTree node by different order.but are shown in increasingorder.
    like this:
    [10 - 20]
    [20 -40][
    [30- 60].
    how to control tree node.

    Implement the Comparable interface in t he userobject class and possibly the toString(0 as well.
    Ex.
    public class UserObject implements java.lang.Comparable{
    public int compareTo(Object obj) throws ClassCastException
    public String toString()

  • Array of Ftree.Node type

    Hi,
    I'm using forms6i.
    I want to create an array of nodes.
    Like i have seen, using varray, to create array of varchar like
    TYPE name IS VARRAY(4) OF VARCHAR2(10);
    I want something like this
    TYPE prev_node IS VARRAY(4) OF FTREE.NODE;
    But when i'm using this, i'm getting Exception
    Unsupported type in a VARRAY or TABLE type: FTREE.NODE.
    Is there a way to create an array of nodes???
    Help Please

    Thank You BaiG
    My requirement is , say i have a resultset(REF Cursor) with 3 columns say t1,t2 and t3
    t1 should be added as root_node , and the return value for the add_tree_node() for t1 is to be stored in a variable(here i want to use array).
    and t2 should be added as a child of t1.
    node1 := Ftree.Add_Tree_Node(htree,
                                       Ftree.ROOT_NODE,
                                       Ftree.PARENT_OFFSET,
                                       Ftree.LAST_CHILD,
                                       Ftree.EXPANDED_NODE,
                                       getnodes.t1,
                                       NULL,
                                       getnodes.t1);
    node2 := Ftree.Add_Tree_Node(htree,
                                       node1,                --  here im using previously added node
                                       Ftree.PARENT_OFFSET,
                                       Ftree.LAST_CHILD,
                                       Ftree.EXPANDED_NODE,
                                       getnodes.t2,
                                       NULL,
                                       getnodes.t2);This node1, node2 etc i want to store in an array.
    Or since node1,node2 etc will be numbers, is it ok if i use varray of number??
    Thanks

  • Custom Sort for nodes in a hierarchy

    Hi All,
    I would like to know how to sort nodes according to a specific order in a hierarchy. I know at the hierarchy level you can set the StandardHierSort property to a custom property i.e CustSortOrder.
    But for the custom property CustSortOrder, how do i set it up so the nodes in the hierarchy will be sorted according to the custom list?
    Thanks
    R

    This is right out of the MDM_User_guide (Look under Custom Sort Order)
    Custom Sort Order
    Nodes can also be sorted in any explicit custom sort order (although limbs are always sorted
    ahead of leaves.) The sort order can be defined by any property that has a property data type of
    SortOrder. (The SortOrder data type is special case of an Integer data type.) By default, any
    Hyperion MDM installation includes a property called Sort Order (assigned to the Default
    property category) that can be used for this purpose.
    To sort a hierarchy according to the value of a node-level sort order property, the hierarchylevel
    property StandardHierSort must have its value set to point to the appropriate node-level
    property that contains the sort order.
    A custom sort order can also be used that applies only to a specific Hyperion MDM user ID,
    enabling users to customize their display of Hyperion MDM data without impacting other users
    of the same hierarchy. This is controlled by the hierarchy-level property UserHierSort. If this
    property has been set to point to a node-level property that has a data type of Sort Order, then
    this sort order takes precedence over both the StandardHierSort property and the default sort
    order.
    If there is no value assigned to the hierarchy-level property StandardHierSort nor to
    UserHierSort, then the default sort order is applied.
    The value of a custom sort order property can be set in any of the following ways:
    1.Sort order values can be loaded into a node-level sort order property when data is initially
    imported into Hyperion MDM (see following for details.)
    2. Explicit values can be defined for the sort order property for any node.
    If a sort order property has been selected for a hierarchy’s StandardHierSort or UserHierSort
    properties, then the Order Children menu option is available by right-clicking on any node
    in a hierarchy. This opens a dialog box that enables the sort order of limbs and leaves to be
    set graphically.
    3. A node-level sort order property might be defined as Derived, and so might be automatically
    populated with a sort order.

  • How to sort jTree Nodes

    Hi,
    I am interested in whats the easiest way to sort jTree Nodes alphabetically. Is there any Method to do this directly or may i use something like quicksort?
    Thanks for help
    Mirco

    Thanks Hamed,
    Well, I work in your code, and I post here.
      public static DefaultMutableTreeNode sortTree(DefaultMutableTreeNode root) {
                     for (int i =0; i<root.getChildCount()-1; i++) {
                              DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(i);
                            String nt = node.getUserObject().toString();
                            for (int j=i+1;j<=root.getChildCount()-1;j++)
                                     DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root.getChildAt(j);
                                        String np = prevNode.getUserObject().toString();
                                System.out.println(nt+" "+np);
                                if (nt.compareToIgnoreCase(np)>0) {
                                               root.insert(node, j);
                                             root.insert(prevNode, i);
                            if (node.getChildCount() > 0) {
                        node = sortTree(node);
                     return root;
        }and this code I used after include in jtree
      public  void jTreeSortingBegin()
              dn = (DefaultMutableTreeNode)treeModel.getRoot();
              treeModel.reload();
              dn = sortTree(dn);
              treeModel.reload(dn);
        }for exemple
      addObject(jTextField1.getText());
            jTreeSortingBegin();

  • Sorting XML nodes in Java

    I have a java code that reads various xml files, filters cetain elements and writes the results of these files to one large xml file. Problem is, when the files are read into the large xml, all the nodes are sorted alphabetically. I tried looking for an API that's responsible for this but I cant find one. Can anyone please help?? Here's the portion of my code that writes the file:
             private static void writeFile(Document doc, ArrayList docIdList,
                   BufferedWriter output) {
              try {
                   Element loElmt = null;
                   NodeList loDocumentList = XMLUtil.getNodeList(doc,
                             "/XML_EXPORT_FILE/DOCUMENT");
                   for (int i = 0; i < loDocumentList.getLength(); i++) {
                        Element loDocument = (Element) loDocumentList.item(i);
                        String lsDocCode = loDocument.getAttribute("DOC");
                        String lsDocId = loDocument.getAttribute("DOCS");
                        //System.out.println(lsDocCode + "\t\t" + lsDocId);
                        // doc identifer is in list
                        if (isDocInList(docIdList, lsDocCode, lsDocId)) {
                             String document = XMLUtil.transformToString(loDocument);
                             System.out.println("Writing " + lsDocCode + "\t\t"
                                       + lsDocId + " to output file");
                             output.write(document);
              } catch (Exception e) {
                   e.printStackTrace();
              }

    I have a java code that reads various xml files, filters cetain elements and writes the results of these files to one large xml file. Problem is, when the files are read into the large xml, all the nodes are sorted alphabetically. I tried looking for an API that's responsible for this but I cant find one. Can anyone please help?? Here's the portion of my code that writes the file:
             private static void writeFile(Document doc, ArrayList docIdList,
                   BufferedWriter output) {
              try {
                   Element loElmt = null;
                   NodeList loDocumentList = XMLUtil.getNodeList(doc,
                             "/XML_EXPORT_FILE/DOCUMENT");
                   for (int i = 0; i < loDocumentList.getLength(); i++) {
                        Element loDocument = (Element) loDocumentList.item(i);
                        String lsDocCode = loDocument.getAttribute("DOC");
                        String lsDocId = loDocument.getAttribute("DOCS");
                        //System.out.println(lsDocCode + "\t\t" + lsDocId);
                        // doc identifer is in list
                        if (isDocInList(docIdList, lsDocCode, lsDocId)) {
                             String document = XMLUtil.transformToString(loDocument);
                             System.out.println("Writing " + lsDocCode + "\t\t"
                                       + lsDocId + " to output file");
                             output.write(document);
              } catch (Exception e) {
                   e.printStackTrace();
              }

  • How to sort master-node in master-detail scenario without losing subnodes?

    Hi,
    I've a master-detail scenario and want to sort my master node.
    How can I sort the master node without losing the detail-subnodes?
    If I take a look in class CL_WDR_TABLE_METHOD_HNDL and method  IF_WD_TABLE_METHOD_HNDL~APPLY_SORTING
    Sorting is done by
    - unload node with context_node->get_static_attributes_table into an internal table
    - keeping node state like lead_selection(s) and attribute_properties
    - sort internal table
    - bind internal table to node
    - set lead_selection and properties
    But all subnodes are gone.
    How do you sort a master node?
    Thanks and Regards
    Carsten

    I think you have to write your own logic for that . May be you can implement IF_WD_TABLE_METHOD_HNDL in your class and extend the current logic to support subnodes.

  • Sorting a node and table

    can any one tell, How to sort a dynamically generated table and dynamically generated node?

    Thanks Anja,
    I am custamizing MSS Approve/Review timesheets iview.
    in that i need to sort the table based on attendence type(meal period hours , attendence hours,etc are att types) and
    display subtotals for each attendence type. That is in webdynpro java.

  • Sort A Node Array?

    I am retrieving a Array of Nodes and looping through them to produce navigation... The problem is that I can't seem to sort them... Here is my code
    <br>
    <b><cm:getNode path="<%=GearboxConstants.BEA_REPOSITORY_DEFAULT_INFO_MENU_NODE%>" id="gearBoxMenuNode"/><br>
    <%if (gearBoxMenuNode != null) {<br>
    Node gearboxMenus[] = gearBoxMenuNode.getChildren();<br>
    if (gearboxMenus != null && gearboxMenus.length > 0) {
    %><br>
    <es:forEachInArray id="gearBoxMenuItem" type="com.bea.content.Node" array="<%=gearboxMenus%>"></b><br>
    here is what I have tried
    Arrays.sort(gearboxMenus) --> It blows up
    and also CM:Search but I can only get either all submenus or nothing..
    this should be easy but I am missing something...

    Chris Whittle wrote:
    here is what I have tried
    Arrays.sort(gearboxMenus) --> It blows up
    and also CM:Search but I can only get either all submenus or nothing.. com.bea.content.Node does not support the Comparable interface which the basic
    Array.sort(Object[] array) requires. Create your own comparator implementation
    and use Array.sort(Object[] array, Comparator comparator).
    Cheers,
    Gerald

  • SORT, ADD Nodes

    Hello,
    I'm trying to understand how DRM determines where to ADD a node during the Action script process. I currently have the sortLimbsFirst system preference = False. A couple of examples: I am adding new leaf level nodes which are numeric_alpha format. After the action script the new leaf level nodes are added to the top of the section.
    For example:
    10000
    10010_dhfjf --> this is the new member
    10001_fkldj
    10002_hflsh
    10008_dhdfj
    Why was the new member 10010_dhfjf added above 10001_fkldj?
    Next example:
    100000
    100001 - Limb
    100002 - Limb
    100018 - New Limb
    100018_hdjlk - New leaf
    100006 - Limb
    100010 - Limb
    If I can understand why DRM is placing these new nodes in the hierarchies where it is, then I can figure out if there is a way to insure they will be loaded in an alpha_numeric order.... or some type of order.
    Many thanks!

    Thanks, Everyone!
    I have a SORT property defined and assigned to the StdHierSort hierarchy property. Not the Core.SortOrder - not sure of this makes a difference. I don't understand the second step of assigning a default value to the SORT property. Should this value be a maximum # of possible children (nodes) PER parent? And how is that used when ADDing a new member using an action script? The goal is to get the ADDed node in the right position during the action script add so the DRM admin does not need to move each node into the correct sort order.
    Many, many thanks for your assistance!

  • XML: sorting XML nodes

    How would I sort a bunch of XML nodes? I don't necessarily
    need to change the existing structure, but I do need to iterate
    through in a specific order. In AS2 I would use the childNodes
    array and use Array.sort.

    And here's a attribute sort function from
    http://freerpad.blogspot.com/2007/07/more-hierarchical-sorting-e4x-xml-for.html.
    var xml:XML =
    <root>
    <node id="2">alpha</node>
    <node id="3">delta</node>
    <node id="5">bravo</node>
    <node id="0">foxtrot</node>
    <node id="1">echo</node>
    <node id="4">charlie</node>
    </root>
    sortXmlAttribute(xml,"id",true, Array.CASEINSENSITIVE);
    trace(xml)
    function sortXmlAttribute
    ( avXml :XML,
    avAttributeName :String,
    avPutEmptiesAtBottom :Boolean,
    avArraySortArgument0 :* = 0,
    avArraySortArgument1 :* = 0 )
    :void
    var lvChildrenCount:int
    = avXml.children().length();
    if( lvChildrenCount == 0 )
    return;
    if( lvChildrenCount > 1 )
    var lvAttributeValue :String;
    var lvXml :XML;
    var lvSortOptions:int
    = avArraySortArgument0 is Function
    ? avArraySortArgument1 : avArraySortArgument0;
    var lvSortCaseInsensitive:Boolean
    = ( lvSortOptions & Array.CASEINSENSITIVE )
    == Array.CASEINSENSITIVE;
    var lvArray:Array = new Array();
    for each( lvXml in avXml.children() )
    lvAttributeValue
    = lvXml.attribute( avAttributeName );
    if( lvSortCaseInsensitive )
    lvAttributeValue
    = lvAttributeValue.toUpperCase();
    if( lvArray.indexOf( lvAttributeValue ) == -1 )
    lvArray.push( lvAttributeValue );
    } // for each
    if( lvArray.length > 1 )
    lvArray.sort
    avArraySortArgument0,
    avArraySortArgument1
    if( avPutEmptiesAtBottom )
    if( lvArray[0] == "" )
    lvArray.push( lvArray.shift() );
    } // if
    } // if
    var lvXmlList:XMLList = new XMLList();
    for each( lvAttributeValue in lvArray )
    for each( lvXml in avXml.children() )
    var lvXmlAttributeValue:String
    = lvXml.attribute( avAttributeName );
    if( lvSortCaseInsensitive )
    lvXmlAttributeValue
    = lvXmlAttributeValue.toUpperCase();
    if( lvXmlAttributeValue == lvAttributeValue )
    lvXmlList += lvXml;
    } // for each
    } // for each
    avXml.setChildren( lvXmlList );
    } // if
    for each( var lvXmlChild:XML in avXml.children() )
    sortXmlAttribute
    lvXmlChild,
    avAttributeName,
    avPutEmptiesAtBottom,
    avArraySortArgument0,
    avArraySortArgument1
    } // for each
    } // sortXmlAttribute

  • Sorting of nodes in a treeTable

    hi,
    i got a problem like that how to make sorting in JtreeTable model.the problem is i am passing i am constructin the JtreeTable model by passing DefaultMutableTreeNode object.which contains Nodename and value.I need to sort only by name.
    for example DefaultmutableTreeNode object contains nodename as B,D,F,T and nodevalue is 8,8,6,5
    i am displaying this in table as a two columns.
    nodename value
    --A               8
    B 8
    C 6
    +D               5
    I need sorting by nodenames.
    one importent thing is am constructing a wholedata in to a DefaultMutableTreeNode and i am passing to a TreeTable model.Any java swing expert please help me with a solution.
    samplecode:
    for example i am constructing the DefaulrmutableTreeNodeobject like this.
    data = new MainData(nodeName,nodevalue);
    l_childNode = new DefaultMutableTreeNode(data);
    l_childNode.setUserObject(data)
    l_rootNode.add(l_childNode);
    finally i am constructing a treeTable Model by using this l_rootNode.
    Please help me how can make soritng in the treeTable model.
    please post any similar examples..
    waiting for replay.

    Moin David,
    ja, die Sortierung wird tatsächlich z.Zt. nicht unterstützt:
    Hello @all,
    The SAP support has confirmed that sorting in grid with collapseLevel is not supported at this time.
    I've opened a new thread in the "SAP Business One Product Development Collaboration "-area.
    As I understand the chance of impementing this feature raises the more users support this request there.
    So I would like to invite you to answer this thread if you agree that the sorting feature should be implemented:
    Thanks!
    As a workaround I have added a new column in the SELECT (and DataTable and Grid). This column contains a "composite key" of the CollapseLevel-Cols PLUS(!) the failed sorting column and is named "Collapse4" in this example.
    U_Col04 was the column of the grid leafes where the sorting has failed before.
    The CollapseLevel must be incremented by 1:
    SELECT
    U_Col01 AS 'Collapse1',
    U_Col02 AS 'Collapse2',
    U_Col03 AS 'Collapse3',
    U_Col01 + '-' + U_Col02 + '-' + U_Col03 + '-' + U_Col04 AS 'Collapse4'
    FROM
    etc....
    There is nothing to expand in Collapse4 than always ONE row. But Collapse4 is sorted now.
    Roland
    Edited by: Roland Toschek on Sep 3, 2008 12:32 PM

Maybe you are looking for