Sorting within Hierarchical Structures

Hello,
I have a hierarchical tree structure that returns from an SQL statement of mine using START WITH and PRIOR etc.
My question is how can I sort the children of a parent.
As an example, my tree returns:
Parent
Child 1
Child 2
Child 1 of Child 2
Child 2 of Child 2
Child 3 of Child 2
Child 3
etc, etc..
But I want to be able to dictate the order in which everything is displayed. For example, I want to be able to do this:
Parent
Child 1
Child 3
Child 2
Child 2 of Child 2
Child 1 of Child 2
Child 3 of Child 2
I have some sort order fields in my table but I just can't get the right SQL clause.
Should I be trying to run multiple SQL clauses? or is there a Magic Golden SQL statement to solve my problems?
Any help (I don't need the code as such, just the strategy) will ge great.
rgds

Looks like you have an arbitrary sorting order (2, 1 ,3). You might be better of populating a table
(temporary, plsql or persistant) and then using a form (or some other method) to assign the sort order.
best of luck.
Hello,
I have a hierarchical tree structure that returns from an SQL statement of mine using START WITH and PRIOR etc.
My question is how can I sort the children of a parent.
As an example, my tree returns:
Parent
Child 1
Child 2
Child 1 of Child 2
Child 2 of Child 2
Child 3 of Child 2
Child 3
etc, etc..
But I want to be able to dictate the order in which everything is displayed. For example, I want to be able to do this:
Parent
Child 1
Child 3
Child 2
Child 2 of Child 2
Child 1 of Child 2
Child 3 of Child 2
I have some sort order fields in my table but I just can't get the right SQL clause.
Should I be trying to run multiple SQL clauses? or is there a Magic Golden SQL statement to solve my problems?
Any help (I don't need the code as such, just the strategy) will ge great.
rgds

Similar Messages

  • How to implement hierarchical structure of managers and reportees using jdeveloper adf

    I want to display hierarchical structure(which can be expanded and compressed) with 3 columns(Employeeid, fist Name,lastname) of managers and his reportees on selecting a top level manager.
    In this i'm going to use programmatic view objects.
    I have employees table.
    Here is my detailed requirement:
    On selecting a user from drop down list, i want to display the list of users reporting to him.
    From the displayed list on selecting a manager, list of users reporting to him has to be displayed in a tree format with the correspoding just being listed below the current selected manager
    Example :
    Top Manger  has been selected from dropdown and clicked submit.
    Output(a table as mentioned below):
    Manager1
    Manager2
    NonManager1
    Manger 3
    On clicking manager1,
    output:
    Manger 1
      Manger11
      Manasger12
      Nonmanager11
    Manger 2
    NonManger1
    Manger3
    on clicking manager1 again, tree has to be compressed and the output has to be just the same as first output.
    Please help me on this by sharing information or any references on how can i achieve this implementation using Jdeveloper adf concepts.
    Will be waiting for the inputs.
    Thank You,
    Dev

    Obviously, you can only display one picture.  So then the question becomes which picture to show.  Therefore, you will have to create some sort of preference of one pattern over another.
    I would use a FOR loop so that you can loop through your available patters and their possible results.  Use the Conditional Terminal on the FOR loop so that you can stop the loop on the first match.  Then you just wire up the selected value for the ring outside of the loop.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Need suggestion on Develop the Hierarchical Structure OAF page--priority

    Hi experts,
    i need to develop the hierarchical structure of OAF page, for this devlopment i need suggestions from you side.
    please find below diagram how to develop the OAF page.
    CEO
    |
    vice president vice president
    | |
    managers managers managers managers
    | | | |
    developer develoer developer developer developer
    Like that i need to develop the OAF page please give me some inputs. Is it feasible in OAF.

    CEO
    |
    vicepresident vicepresident
    |
    manager manager manager manager manager
    | | | | |
    develper developer developer developer

  • How to read a file with data in Hierarchical Structure using XSD Schema

    Hi
    We have requirement in which we have to read a FIXED LENGTH file with FILE ADAPTER. File contains the data in hierarchical structure. Hierarchy in the file is identified by the first 3 characters of every line which could be any of these : 000,001,002,003 and 004. Rest files are followed after these. So structure is like:
    000 -- Header of File. Will come only once in file. Length of this line is 43 characters
    -- 001 -- Sub Header. Child for 000. Can repeat in file. Length of this line is 51 characters
    --- 002 -- Detail record. Child for 001. Can repeat multiple times in given 001. Length of this line is 43 characters 1353
    -- 003 -- Sub Footer record at same level of 001. Will always come once with 001 record. Child for 000. Length of this line is 48 characters
    004 -- Footer of file.At same level of 000. Will come only once in file. Length of this line is 48 characters
    Requirement is to create an XSD which should validate this Hierarchical Structure also i.e data should come in this hierarchy only else raise an error while parsing the file.
    Now while configuring the FILE ADAPTER to read this file we are using Native Schema UI to create the XSD to parse this structure using an example data file. But we are not able to create a valid XSD for this file which should validate the Hierarchy also on the file.
    Pls provide any pointers or solution for this.
    Link to download the file, file structure details and XSD that we have created:
    https://docs.google.com/file/d/0B9mCtbxc3m-oUmZuSWRlUTBIcUE/edit?usp=sharing
    Thanks
    Amit Rattan
    Edited by: user11207269 on May 28, 2013 10:16 PM
    Edited by: user11207269 on May 28, 2013 10:31 PM
    Edited by: user11207269 on May 28, 2013 10:33 PM

    Heloo.. Can anyone help me on this. I need to do Hierarchial read / validation while reading the file using File Adapter using Native XSD schema.

  • Hierarchical Structure in Sender FCC

    Hi all,
    I am working on a file to file scenario.
    The sender data type is in following format -
    File_Header
    Record_ID
    Filler_S
    Batch_Header
    Record_ID
    Filler_S
    Payment_Node
    Record_ID
    Filler_S
    All the nodes are with key fields.
    File_Header Keyfield - 1, Batch_Header Keyfield - 2, Payment_Node Keyfield - 3.
    I want to know whether it is possible to have FCC on sender File adapter for this hierarchical structure.
    The source XML message should be in following format -
    <?xml version="1.0"; encoding="UTF-8"?>
    <Test>
    <File_Header>
    <Record_ID>1</Record_ID>
    <Filler_S>12</Filler_S>
    </File_Header>
    <Batch_Header>
    <Record_ID>2</Record_ID>
    <Filler_S>12</Filler_S>
    <Payment_Record>
    <Record_ID>3</Record_ID>
    <Filler_S>12</Filler_S>
    </Payment_Record>
       </Batch_Header>
    </Test>
    Currently I am getting source XML in this format.
    <?xml version="1.0"; encoding="utf-8" ?>
    <ns:Test xmlns:ns="urn:testhierarchy:fcc">
    <File_Header>
    --<Record_ID>1</Record_ID>
    --<Filler_S>01</Filler_S>
    </File_Header>
    <Batch_Header>
    --<Record_ID>25</Record_ID>
    --<Filler_S>20</Filler_S>
    </Batch_Header>
    <Payment_Record>
    --<Record_ID>6</Record_ID>
    --<Filler_S>22</Filler_S>
    </Payment_Record>
    </ns:Test>
    i.e. Payment_Record and Batch_Header are at same level. I want Payment_Record under Batch_Header.
    Kindly let me know if hierarchical structures can be handled in sender FCC. If yes then what should be the FCC parameters?
    Thanks i.

    Hi Minal,
    We have Source structure same as yours. I am trying to use FCC to handle multiple hierarchy levels at sender side.
    Can you please let me know if you have some solution for it?
    Thanks,
    Pooja.

  • Mapping Query: Flat Structure to Hierarchical Structure.

    I have a scenario which uses the sender file adapter. Therefore my source message has a flat structure. The requirement is that the target message will have a hierarchical structure as shown below.
    Source Message Type
    MT_Acc_Out    1..1
    …fileHeader   1..1
    …docHeader    1..unbounded
    …docItem      1..unbounded
    …fileTrailer  1..1
    Target Message Type
    MT_Acc_In     1..1
    …batchHeader  1..1
    …docHeader    1..unbounded
    ……docItem     1..unbounded
    …fileTrailer  1..1
    The source structures docHeader and docItem both contain a field called seqNo which is used to link the items to the header.
    The requirement is that in the target message the docItems are children of the corresponding docHeader.
    I am having difficulty mapping the target docItem node. Does this require a user defined function or can it be achieved using standard functions?
    Any assistance would be appreciated.

    You can use standard or user-defined functions, see this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/59/f6ae42e0fac911e10000000a1550b0/frameset.htm
    see the part of flat structure_2_nested tables part.

  • Hierarchical structure download to excel

    Hi Experts,
    I have got the requirement of downloading hierarchical  to excel.  For example , In tcode se43n , the result  shown in hierarchical structure   has to be downloaded to excel sheet with all child nodes( Expanded tree ).
    Is there any FM which does the purpose or any input on this.
    I appreciate your valuable inputs...
    Thanks
    Santhosh

    Santhosh,
    <li>Without function module you can download the expanded tree structure
    <li>Goto SE43n->Enter Area menu name->Display->Place the cursor on the top node->Click Edit menu->Expand all(Shift+f6).
    <li>Now Menu tree is expanded
    <li>Click on Area Menu menu->Print->Area menu is now shown in different view->click on Print List menu->Save to PC file->Spreadsheet
    I hope that it solves your problem.
    Thanks
    Venkat.O

  • Represent hierarchical structure in graphical structure (by reports?)

    Hi
    I have a parent child relationship where I am using sys conect by path to represent the relationship. Can I display this relationship in graphical structure in Orace Reports?

    Why does Java follow the hierarchical structure i.e
    Object class is the root class which is extended by
    all classes by default..
    Can anybody tell the reason for this.It's for technical reasons. In this way any class and class hierarchy always have a known super-superclass namely Object. This means that API's can be written assuming this class only and they will then work with objects of any class. Examples of this are the Collections and Swing.

  • Create hierarchical structure in tree form

    we want model coding to create an hierarchical structure .
    example :
          . masters
                under masters material master,sales  masters,etc should come.
             items
               under items item details will come.
            customers
                  under customers different customer names will display

    HI,
    take a look to this functions:
    BAPI_HIERA_ADDSUBCLASS
    BAPI_HIERA_ADDSUBSTRUCTURE
    BAPI_HIERA_CHANGESUBCLASS
    BAPI_HIERA_CHANGESUBSTRUCTURE
    BAPI_HIERA_CHECKSUBCLASSALLOC
    BAPI_HIERA_GETDETAILSUBCLASS
    BAPI_HIERA_GETSUBCLASSALLOCS
    BAPI_HIERA_GETSUBSTRUCTURE
    BAPI_HIERA_GETSUPERCLASSALLOCS
    BAPI_HIERA_GETSUPERSTRUCTURE
    BAPI_HIERA_REMOVESUBCLASS
    BAPI_HIERA_REMOVESUBSTRUCTURE
    CRS_CUST_HIERARCHY_COLLECT_CRE
    Regards Nicole

  • How can I export my Firefox bookmarks (and the hierarchical structure of folders) to the Scrapbook Add-On?

    I'm trying to replicate the hierarchical structure of my Firefox bookmarks in Scrapbook and save the webpages automatically. Is that possible in an automatic (or easy) way?
    Many thanks

    I'm not sure how Scrapbook works, but if you open a web page, can it automatically capture all the linked pages? If so, try this:
    (1) Export your bookmarks to an HTML file, and save it in a convenient locaiton (e.g., desktop). This article has the steps: [[Export Firefox bookmarks to an HTML file to back up or transfer bookmarks]].
    (2) Open the file you just created in Firefox. You could double-click the file, or use Open from the menu, or drag and drop it on an open tab.
    Will Scrapbook work with that?

  • Industrial hierarchical structure on CRM GUI.

    I am trying to create an industrial hierarchical structure on CRM GUI on SPRO(Cross application componentes,SAP Business Partner,Business partner,Organizations,Mantain Industry System and Industries). I would like to know if exist any tool or if is possible to download massively my data,from an excel file,to CRM, considering the hierarchical structure.
    Thank you for your help.
    Francesco

    Hi Here i am also facing problem to identify the  link table  or field  between territory id and child territory ,  so if anybody could help us...
    Thanks.
    Vivek

  • Build a hierarchical structure from a ordered table

    Hi guys,
    say I have a table A with 3 columns, each column represents a level in a hierarchical structure. Is it possible to make a recursive query (connect by) to retrieve the info in a hierarchically way?
    TABLE A.
    COL1 COL2 COL3
    1 2 3
    1 2 4
    1 2 5
    The tree I want should be something like:
    1
    2
    3
    4
    5
    Thanks for your help!.

    Not really, there was a display problem. What happen is that I want to display a tree in Forms based on the info I have in my table, so the tree(implemented with FTREE) has to look like this:
    +1
    --+2
    ----3
    ----4
    ----5
    As you can see, if the table would be with only 2 columns with an pig ear relationship this would be very easy, however my hierarchy of my table is based on the position of the columns:
    COL1 father of COL2
    COL2 father of COL3
    and so on...
    My problem is that I don4t know how the query I have to fill in the Data Query property of my tree has to be.
    I tried on Forms forum but didn't get any answer, so I hope you sql guys may give a clue, as I know you're very smart in this area.
    Thanks for your sooner input.!

  • Sort within an array?

    public class Input3
         private String[] input = new String[40];
         private static int StringNum = -1;
         public static final int NUMBER_OF_TEAMS = 3;
         public static final int NUMBER_OF_PLAYERS = 5;
         public Input3()
              //The first six inputs will be for the first team
              input[0] = "LAKERS";
              input[1] = "Kobe Bryant";
              input[2] = "Derek Fisher";
              input[3] = "Shaquille O'Neal";     
              input[4] = "Karl Malone";
              input[5] = "Brian Cook";
              //The next six inputs will be for the second team
              input[6] = "MAVERICKS";
              input[7] = "Antoine Walker";
              input[8] = "Dirk Nowitzki";
              input[9] = "Tony Delk";
              input[10] = "Shawn Bradley";
              input[11] = "Travis Best";
              //The next six inputs will be for the third team
              input[12] = "KNICKS";
              input[13] = "Mike Sweetney";
              input[14] = "Allan Houston";
              input[15] = "Howard Eisley";
              input[16] = "Kurt Thomas";
              input[17] = "Shanon Anderson";
         //This method returns the strings one after the other.
         public String getNextString()
              StringNum++;
              return input[StringNum];
    }What I'm supposed to do with this is sort that data by last names within each team. By that I mean I have to sort input[1] through input[5] by last names, input[7] through input[11] by last names, and same for the Knicks team. I'm not sure how to do 3 separate sorts within an array.
    The output should look like this:
    KNICKS:
    Sharon Anderson
    Howard Eisley
    Allan Houston
    Mike Sweetney
    Kurt Thomas
    Any help is greatly appreciated!

    Yeah, I don't really understand it. But my professor actually gave us that code to work with to be part of a bigger assignment. I actually just posted another question about the same assignment if you want to look at that to see if it might help.
    I dunno how to use the insert link button on here so I'll just let you copy and paste if you are interested in helping me out... Thanks!
    It's here >>> http://forum.java.sun.com/thread.jspa?threadID=5268839

  • Custom sorting within "for-each-group:current-group"

    Hi, I need some help in doing a custom sort within a "for-each-group:current-group". My formatting is in a table format but I'm not sure how to post a table here so I'm just arranging the column details out as it would look in a table. I have a column on the left for the YEAR and a second column on the right for the DESCR. Under the DESCR column I've inserted a nested table with four columns: SUBJECT, CATALOG_NBR, DESCR250 and GRADE.
    COLUMN 1:
    <?for-each-group:row_table;./ YEAR?><?sort: YEAR;'ascending';data-type='text'?><?YEAR?>      
    COLUMN 2:
    <?for-each-group:current-group();./DESCR?><?DESCR?>
    NESTED TABLE (with 4 columns):
    +<?for-each:current-group()?><?SUBJECT?><?CATALOG_NBR?><?DESCR250?><?GRADE?><?end for-each?>+
    <?end for-each-group?> <?end for-each-group?>
    I'm able to sort by YEAR in the "for-each-group" on the left column. But I also want to do a custom sort on DESCR in the right column.
    I've seen this blog on custom sorting by Vetriselvan: http://winrichman.blogspot.com/2009/09/custom-dynamic-sort-in-bi-publisher.html and I tried inserting this sort below after <?for-each-group:current-group();./DESCR?> but I get an error message.
    <?sort:(number(DESCR='Status')*1)+(number(DESCR='First Semester')*2)+(number(DESCR='Second Semester')*3);'ascending';data-type='number'?>
    I've also seen this thread: Re: Sort within group and tried inserting <?for-each:DESCR?> before the sort (as below) - this time I can preview the results, but it is not sorting as required.
    <?for-each:DESCR?><?sort:(number(DESCR='Status')*1)+(number(DESCR='First Semester')*2)+(number(DESCR='Second Semester')*3);'ascending';data-type='number'?>
    Can anyone help me custom sort the DESCR column? I'm using Template Builder for Word version 5.6 build 45. Thanks in advance for any help!

    Hi Vetsrini,
    I tried adding <?sort: ./DESCR;'ascending';data-type='text'?> after <?for-each-group:current-group();./DESCR?> but I'm getting an error message.
    The DESCR values are below and I'm trying to sort them in the following order.
    STATUS
    SUMMER SEMESTER
    FIRST SEMESTER
    AUTUMN SEMESTER
    WINTER SEMESTER
    SECOND SEMESTER
    SPRING SEMESTER
    Because I need them in the above order, I can't use ascending or descending, and instead need to use a custom sort order. Do you know how I can go about creating a custom sort order?
    Thanks!

  • Conditions within a Structure

    Is is possible to use a condition in a query that has a structure in the rows?  If so, please explain.

    Hi Eugene,
    I should elaborate.  Yes, I have tried it and it does work if I have 1 selection within the structure within the rows.  I have multiple rows with the same material that is grouped within the selections by a transaction type.  When I have more than 1 selection, any material that meets the conditions at the first selection level is repeated in every selection although the criteria is not met.  I feel this defeats the purpose of using a condition.  I would like it to consider each record independently.  If you do not receive this type of results, perhaps you are doing something different than me.  Please advise.
    Thanks,
    Diane

Maybe you are looking for