Professional Web Applications Themes

Recursion Excursion !!! - Coldfusion - Advanced Techniques

I have a database that looks like this: You can see that my tree goes 3-layers deep. However, I am unable to figure out how to recursively trace this query. I've included all source (including the DDL) and would very much appreciate if someone could either take a look at the code or send me to a good resource that covers tree (not using CFTREE) navigation using Coldfusion. Thanks again so much for your help. http://www.allanparsons.com/upload/sidemenu_dynamic.zip +---------+-----------------------+-----------+-----------------------+ | link_id | link | parent_id | link_desc | +---------+-----------------------+-----------+-----------------------+ | 1 | ./dashboard.cfm | 1 | Dashboard | | 2 | ./prodinit.cfm ...

  1. #1

    Default Recursion Excursion !!!

    I have a database that looks like this:


    You can see that my tree goes 3-layers deep. However, I am unable to figure
    out how to recursively trace this query. I've included all source (including
    the DDL) and would very much appreciate if someone could either take a look at
    the code or send me to a good resource that covers tree (not using CFTREE)
    navigation using Coldfusion.

    Thanks again so much for your help.

    http://www.allanparsons.com/upload/sidemenu_dynamic.zip

    +---------+-----------------------+-----------+-----------------------+
    | link_id | link | parent_id | link_desc |
    +---------+-----------------------+-----------+-----------------------+
    | 1 | ./dashboard.cfm | 1 | Dashboard |
    | 2 | ./prodinit.cfm | 1 | Prod Init Dashboard |
    | 3 | ./prodbackupaudit.cfm | 1 | Non-Prod Backup Audit |
    | 4 | ./enterprise.cfm | 4 | Enterprise Tools |
    | 5 | ./orgchart | 4 | ORG Chart |
    | 6 | ./dblink.cfm | 4 | RHO DBLink |
    | 7 | ./datafiles.cfm | 4 | Datafiles |
    | 8 | ./org2.cfm | 5 | Testing 2 Deep |
    +---------+-----------------------+-----------+-----------------------+

    aparsons Guest

  2. #2

    Default Re: Recursion Excursion !!!

    If you're using Oracle, you should read up on "CONNECT BY PRIOR".

    But that suggestion notwithstanding, consider not using recursive
    constructs for hierarchical data... do a search on "nested sets".

    --
    Adam
    Adam Guest

  3. #3

    Default Re: Recursion Excursion !!!

    aparsons,

    Speaking from personal experience, I wholeheartedly agree with Adam's
    suggestion about nested sets. IMO they are much more flexible and easier to
    work with. Here is a good overview of nested sets if you're interested.
    http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=235427

    mxstu Guest

  4. #4

    Default Re: Recursion Excursion !!!

    Allow me to jump on the bandwagon with mxstu and to additionally suggest the purchase of Joe Celko's book Trees and Heirarchies in SQL for Smarties. It is an excellent resource for such things.
    Iceborer Guest

  5. #5

    Default Re: Recursion Excursion !!!

    If I do go and implement this Heirarchie in SQL, how would I create a list (using coldfusion)? Are there any examples on that code?
    aparsons Guest

  6. #6

    Default Re: Recursion Excursion !!!

    aparsons,

    There are a number of SQL query examples in the article. There are no CF examples obviously, because that is not the topic of the article. What type of list are you referring to?
    mxstu Guest

  7. #7

    Default Re: Recursion Excursion !!!

    I've looked at that SQL code and have given it to the DBA to implement (they
    don't let me touch that stuff). I'm looking for an example that takes that
    code (shown in your example, MXSTU) and makes an unordered "tree" in coldfusion
    ( <ul> ROOT <li> ONE DEEP <ul> TWO DEEP <li> THREE DEEP </li> </ul> </li> </ul>
    ).

    -Allan

    aparsons Guest

Similar Threads

  1. Syntax for end recursion
    By Robert.Koepferl@de.gi-de.com in forum Ruby
    Replies: 4
    Last Post: July 25th, 10:11 AM
  2. 256 levels of recursion??
    By floyduk in forum Macromedia Flash Actionscript
    Replies: 5
    Last Post: March 6th, 04:19 PM
  3. Size of dir (with recursion)
    By Jesper Noehr in forum PERL Beginners
    Replies: 4
    Last Post: December 29th, 11:08 PM
  4. Recursion
    By Jeff Westman in forum PERL Beginners
    Replies: 15
    Last Post: November 4th, 12:18 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139