An example of such table would be:
| ItemID | ParentItemID | Description |
| 1 | 0 | Animals |
| 2 | 1 | Reptiles |
| 3 | 1 | Birds |
| 4 | 1 | Mammals |
| 5 | 2 | Rattlesnake |
| 6 | 3 | Eagle |
| 7 | 3 | Chicken |
| 8 | 3 | Turkey |
| 9 | 4 | Elephant |
| 10 | 4 | Giraffe |
| ItemID | ParentItemID | Description |
| 1 | 0 | Animals |
| 2 | 1 | Reptiles |
| 3 | 1 | Birds |
| 4 | 1 | Mammals |
| 5 | 2 | Rattlesnake |
| 6 | 3 | Eagle |
| 7 | 3 | Chicken |
| 8 | 3 | Turkey |
| 9 | 4 | Elephant |
| 10 | 4 | Giraffe |
Note: If you are using different name for fields ItemID and ParentItemID, you can alias your field names with these names, when retrieving the recordset. For examplethe following SQL statement aliases the retrieved fields:
SELECT MyItemID AS ItemID, MyParentItemID AS ParentItemID, ...
To register the CFX_MAKE_TREE custom CFX for Cold Fusion,
open the Cold Fusion Administrator, Tags page.
<CFX_MAKE_TREE QUERY="AnimalKingdom">
<CFFORM ACTION="OpenItem.cfm">
<CFTREE
NAME= "Animals" HEIGHT="600" WIDTH="300">
<CFLOOP
QUERY="AnimalKingdom">
<CFTREEITEM VALUE="#ItemID#"
PARENT="#ParentItemID#"
DISPLAY="#Description#"
EXPAND="Yes">
</CFLOOP>
</CFTREE>
</CFFORM>