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

SubReports triplicating themselves...

edited February 2005 in Subreports
Hi,

This is related to the Subreports Newbie question I posted 25/02.

I have three subreports, each of which have their own JITPipeline and
associated events to get the data from their repsective lists. Each work in
their own right in that the data they print is correct, however each sub
report prints three times, they appear thus

External Transport

<== data ==>

Internal Transport

<== data ==>

Own Transport

<== data ==>

This would be correct if it stopped here, but this sequence then appears as
above twice more. It doesn't overwrite the above nor does the third
occurence overwrite the second.

The Print Behaviour property on all three subreports is pbChild

Any ideas please

TIA
Colin B

Comments

  • edited February 2005
    Hi,

    I have narrowed it down to the TraverseBy event, in that if I comment out
    the code in there that increments the index into the third list, along with
    the GetFieldAsString and the GetFieldValue events then there is no
    triplication at all.

    I am going to put some text code in to print the sequence of these events to
    a file and see what it brings up.

    Cheers
    Colin B


  • edited February 2005
    Hi,

    Now I'm totally confused, suffice to say that I am going to start from
    scratch with the whole report, but what leads me to this is that fact that
    even if when I removed the other two subreports the remaining one still
    repeats itself three times, now I donder could this be anything to do with
    the fact that this data set has three records in it as there are no longer
    three sub reports, so it makes me wonder whether this is significant.

    Any thoughts would be gratefully appreciated as I've been playing around
    with this all day now...

    Cheers
    Colin

  • edited February 2005
    Hi again,

    this is turning into a saga now...

    Right so something I didn't mention before was that there are in fact two
    forms, the first is the base class, and is a form and has a ppReport and a
    JITPipline on it. It works in a similar fashion to the Demo project, and
    namely 0136 report, in that is passes back to the caller ppReport by way of
    a property.

    The difference with mine is that there is a constructor where a TppParamList
    is passed in along with an TObjectList, albeit that it is a inherited
    version of it. The constructor calls an abstract method called Intitialise
    passing the paramlist to it, and the TObjectList is assigned locally to a
    variable declared in the protected section.

    The JIT pipeline uses the three events used in 0136 GetDataSetName,
    GetFieldAsString and GetFieldValue, the latter calling another abstract
    method GetRptFieldData.

    Now in the case of the abstract methods the child report must obviously
    implement them as it sees fit, the former simply takes what it knows is in
    the paramlist and assigns it to labels on the report, primarily the Date.
    The latter interrogates the aFieldName and accesses the appropriate field in
    the list indexed by JITPipeline.RecordIndex. Note that RecordCount is set
    up in the base class constructor.

    This makes the whole thing extremely flexible with specific stuff happening
    where necessary, and all the rest in the base class.

    Now all the reports that only need one JITPipeline work fine, but it is
    where i decided to try and be clever (always a worry...) where it came
    unstuck.

    So I started from scratch and instead of putting the External Transport in a
    subreport along with the Internal Transport and the Own Transport sets of
    stats I decided to put it in the main report, as this then ties in with the
    way the other single JITPipeline reports work, so then I thought well as in
    this case I want to put two the two other forms of transport (Int & Own) in
    subreports I would put the DBTexts for the Ext. Trans. in a region and then
    make the Int Trans. SubRpt ShiftRelative to the region and the Own Trans.
    SubRpt relative to the Internal Trans above it.

    So I figured that by adding two JITPipelines to the child report class and
    setting the events in the same fashion as described above it would work like
    clockwork, how naive was I?

    So where I've got to is I added the Int. Trans. sub report made it relative
    to the region, and I set up the GetFieldData etc, but for every record in
    the main pipeline dataset the sub report appears. This I suppose
    understand, given that one might want to have a master record then some
    detail records, but all I want to do it display the contents of three lists
    one after the other, nothing more. I have tried playing around with
    different property settings but to no avail.

    Have I missed something?

    Cheers again
    Colin B


  • edited February 2005
    Hi,

    OK I fixed it, all I needed to do was remove the reference to the base class
    JITPipeline from the ppReport declared at that level, but obviously only for
    the report which has the sub reports.

    Well I'm not going to forget that in a hurry...

    many thanks
    Colin

This discussion has been closed.