How to Build TREE style REPORT

Hi all
in my database i have a table with following structure :

Pkey
Parent
Description ......
1
0
Item1
2
0
Item2
3
2
Item3
4
2
Item4
5
1
Item5
6
3
Item6
7
1
Item7
.
..
...
As you can see the above structure represent a TREE style like the following :
ROOT_ITEM
Item1
Item5
Item7
Item2
Item3
Item6
Item4
BUT notice that the number of records in this table and number of Levels of this tree are Un-Limited
So i want to know how can i create a report that makes an out-put like above TREE.

Thanks in advance.
Regards.

Comments

  • kevin475kevin475 Riverside, CA USA
    edited 11:56PM
    Solution 1
    Sort the records into tree sequence. You can do this by adding a sequence field at every tree level. Then sort by all the sequence fields.

    Solution 2
    Build a tree structure in RAM and load your records into it. Then use a TfrxUserDataSet to feed the records to FastReport in the tree-structure sequence.

    Solution 3
    If you have a product like Developer Express TdbDBTree, you can load the records into the DBTree and then use TfrxUserDataSet to deliver the records in DBTree node sequence.

    Solution 2 is probably the most efficient but Solution 3 is the quickest to implement.

    - Kevin
  • gordkgordk St.Catherines On. Canada.
    edited 11:56PM
    also read the user manual chapter on using the engine object
    to control curx or cury positions of an object.
    ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.