• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Hierarchy

New Here ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

There are a few different examples of this on here, but nothing quite like I need to do. I have a table in my DB with an ID, name and parent fields. I need to output this info in my ui but I am having trouble grouping them.

Query results:

ID Name Parent
100 Test NULL
101 Org1 NULL
102 Org2 101
103 Org3 102


I need to dynamically output this info so that the heirarchy is correct.

Example:

100 - Test
101 - Org1
--102 - Org2
----103 - Org3

Any ideas on making this happen with CFQUERY or CFLOOP?
TOPICS
Advanced techniques

Views

324

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 01, 2007 Apr 01, 2007

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 01, 2007 Apr 01, 2007

Copy link to clipboard

Copied

LATEST
Depending on how complicated your hierarchies are, you might want to consider using nested sets instead of your current hierarchy model. They get a lot of mention on these forums (though I have yet to actually implement one in an actual live project). I know there are better articles on them, but a quick google search for ColdFusion nested sets turned up a number of good articles. Take a look at this thread over at House of Fusion:

http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:44375#230848

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation