Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Creating a report from a TTreeView

edited October 2003 in General
I need to print a report from a TTreeView. Presently I save the TreeView to
a text file and print it from there, but I want a more professional Report.
Actually the output suits my clients needs to the tree structure is just
fine.

What is a simple method to pass a TreeView to ReportBuilder to create a
basic multi-level report following the tree structure?
Larry Killen

RP 5.53 Ent

Comments

  • edited October 2003
    Hi Larry,

    One way you could try would be to traverse your tree structure ahead of time
    and build an index of the nodes to be printed. You can assign each node a
    unique id and place them in a TStringList object. Then using a JITPipeline,
    you can pull the data directly out of the string list and display it in your
    report.

    The article below show how to create a simple index.

    ----------------------------------------------------
    Tech Tip: Using a JITPipeilne to Display Sorted Data
    ----------------------------------------------------

    Question
    --------

    I am using JITpipeline and I want to know is there a way
    to sort the data?


    Solution
    --------

    You can implement this functionality by creating an
    index for your data.


    A simple index can be made using a StringList. You can
    iterate through your data and for each row add an entry
    to the stringlist. Each entry will contain the string
    value to sort and the row index.

    myIndex := TStringList.Create;

    for liRow := 0 to RowCount-1 do
    myIndex.AddObject(StringValueToSort, TObject(liRow));



    Once you load the data, then you can sort the StringList:

    myIndex.Sort;


    Now you have an index in which each item in
    the stringlist contains a pointer to the correct row.

    To get the data for the first row:

    liRowIndex := Integer(myIndex.Object[0]);

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2003
    Larry,

    please have a look at our TreeView for ReportBuilder component at
    www.choosepill.com/components/cpcrbtree.htm . It's exactly designed for this
    purpose and allows you to print a complete TTreeView with images, buttons
    and lines. You can also use this component to print a simple text
    representation of the tree.

    However, this component is only available for ReportBuilder 6.x and 7.x!

    Hope this helps

    --
    Sebastian Modersohn
    ChoosePill components
    www.choosepill.com

  • edited October 2003
    Thanks to both of you. I will need to go with the StringList. My client
    has no interest in upgrading to RP 6 at this time.
    Larry
This discussion has been closed.