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

Printing a self referenced pipeline (tree structure)

edited August 2003 in General
I create a dataset where the records are in parent-child relationship (tree
structure). Depending on the type of each node I print a different region.
All regions are in the detail band. The problem that I have is that I want
to print sums whenever all the children of a node are done. I have created a
group with break field the ParentId so that I'll have a GroupFooter band but
this is called everytime the ParentId changes ie from parent node to child
node the group footer band is printed (before the children start
printing)!!! RB does what it is supposed to do but this is not what I want.
I tried grouping using Custom fields with no success.
Any ideas?
Is it possible to use the pipeline of the report to navigate in the dataset
and set the current record at will?

Thanks
Yannis

Comments

  • edited August 2003
    Hi Yannis,

    How are you traversing the Tree? In order for ReportBuilder to give you the
    correct results, you need to have the data ordered accordingly as if it were
    a TDataset or descendent.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2003
    Thank you Nico,

    I use a TClientDataset which is ordered according to a LineNumber. Although
    it is not ordered according to the ParentId, which is the grouping field,
    the data are displayed correctly but I have the problem with the sums.
    Since yesterday I have used RTTI to make the TCLientdataset component
    visible in RB so I can navigate the report's pipeline (to print a group
    footer I move forward to examine the next record and then step back to the
    original record).
    In RAP I assign to a clientdataset the dataset of the pipeline. Seems to
    work in all cases except when I am in the last page of the report and move
    back one page. Seems like the pipeline is at the End Of File. Is RB
    rebuilding each page when we move back?
    Is there a way to watch how the pipeline goes through the records while
    building a report ?
    Yannis

  • edited August 2003
    Yes, RB regenerates each page if you don't set Report.CachePage to true.
    Setting this to true is one option that should fix the problem.

    The group footer should print when the group changes a group break value. Is
    this not happening? Perhaps you need to define another nested group so that
    you can have more than one group?

    You should not navigate the pipeline as the report generates. RB uses
    bookmarks to navigate the pipeline when backing up and going back forward on
    records it has traversed. Actually, RB can move back and forth in the
    dataset when simply moving across one page to another when a dynamic height
    band tries to generate, but can't fit, so it generates on the next page. Try
    taking out the peek of the next record and see if the problem goes away. You
    may be confusing RB's bookmarks when you navigate the dataset. If you want
    to perform a calculation on a group try using the first pass of a two pass
    report. The first pass doesn't generate output, but rather it simply
    determines the pagination.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Thank you Jim.
    Actually I have done away with the grouping altogether since I do not really
    have a field for grouping. I placed all my regions in the detail band even
    the regions of the totals!!! In the BeforePrint event of the detail band I
    determine which ones to print.
    I just use the clientdataset to move to the next record to check if I should
    print a totals' region. I, of course, return to the original record.
    Everything works fine in my first tests. Do you think I am messing with RB's
    bookmarks and I'll possibly have problems in the future? I could create a
    clone to the pipeline's cds. The sums based on variables work fine - caching
    seems to work.
    What do you think of my solution?
    One more thing. I am trying to assign a value to a string variable (not in
    its OnCalc event) and I am getting an error.
    Finally is there any specifc documentation describing how RB works ie when
    the events are fired etc. It would be very useful to have a deeper
    understanding when you are trying to do funny things as I seem to do.

    Thanks in advance
    Yannis
  • edited August 2003
    Hi Yannis,

    Instead of a client dataset, you can implement any custom datta traversal on
    any kind of data by using a JITPipeline. The JITPipeline has as the events
    so that you can traverse your data tree using the methods that RB prefers.
    In the OnGoToBookmark, you can backup the tree by one record usually. If you
    are using KeepTogether, then you'll have to implement bookmarks on your tree
    traversal engine so that RB can backup N bookmarks. On a related note, if
    you want to print the tree, you can use the treeview component that is
    freeware. Download it from the Friends RCL section at
    www.digital-metaphors.com

    No specific documentation exists on the events other than what is in the
    help file already. There is an event tracker demo which you can use to see
    what is happening at runtime as the report runs with different event
    handlers assigned. It is in the main reports demo project as demos #141-150.


    Cheers,

    Jim Bennett
    Digital Metaphors


    Thank you Jim.
    Actually I have done away with the grouping altogether since I do not really
    have a field for grouping. I placed all my regions in the detail band even
    the regions of the totals!!! In the BeforePrint event of the detail band I
    determine which ones to print.
    I just use the clientdataset to move to the next record to check if I should
    print a totals' region. I, of course, return to the original record.
    Everything works fine in my first tests. Do you think I am messing with RB's
    bookmarks and I'll possibly have problems in the future? I could create a
    clone to the pipeline's cds. The sums based on variables work fine - caching
    seems to work.
    What do you think of my solution?
    One more thing. I am trying to assign a value to a string variable (not in
    its OnCalc event) and I am getting an error.
    Finally is there any specifc documentation describing how RB works ie when
    the events are fired etc. It would be very useful to have a deeper
    understanding when you are trying to do funny things as I seem to do.

    Thanks in advance
    Yannis
This discussion has been closed.