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

raCodMod unit

edited November 2006 in RAP
Hi,
My application, built with Delphi 6 and using ReportBuilder 7.04, displays
random AV errors on rbRAP76.bpl.
Using EurekaLog I see that the exception happens in
TraCodeModule.GetAllProgramCount method found in raCodMod.pas unit.
Trying to trace the error I would like to have the source code of this unit,
but I can't find it.
Can you help me with this ?

Thanks in advance
Manos Aggelakis

Comments

  • edited November 2006

    I recommend updating to RB 10.04. Over time we have fixed some intermittent
    AV's that a few customers were reporting. You can download a trial version
    from our web site if you would like to peform some testing.

    We literally do not have the RB RAP source code for RB 7.04.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2006
    Thank you for your answer Nard.
    I upgraded to ReportBuilder 10.04, but the AV's keep on raising at the same
    point.
    Here is what happens:
    I need to create some TppReports and when I free them rbRAP106.bpl sometimes
    raises AV errors.
    The only solution I found, was a suggestion from you some years ago in a
    similar situation, to use TppReport.Template.New instead of TppReport.Free.
    This eliminated the AV's but, since TppReports are not freed, my application
    consumes small amounts of memory with the execution of each report. Not a
    big issue but not politicaly correct.
    Can you provide any more help ?

    Thanks in advance
    Manos Aggelakis


  • edited November 2006

    - For any objects that you create in code (report, label, etc) make sure
    that use the main report.Owner as the owner.

    - For any elements that you add to a band, set object.Band (do nto call
    Band.AddObject). Likewise if you create a band and add to a report, set
    Band.Report (do not call Report.AddBand).

    example:

    myLabel := TppLabel.Create(Report.Owner);
    myLabel.Band := Report.DetailBand;



    - If you still have an issue and would like to create a simple focused
    example and to support@digital-metaphors.com and we can check it out. Please
    use standard Delphi components, RB and the DBDemos data.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2006
    Thanks again Nard,
    but the main report is also created in my code, and it's owner never gets
    freed.
    Perhaps it will help me if you can explain me why freeing a report in my
    code, causes these random AV's in rbRAP106.bpl.

    BTW the reason I need to create the reports in my code, is because I want to
    use existing reports as dynamically created subreports in a main report,
    which RB7 did not support.
    If this by any chance is supported in RB10, then we probably have a
    solution.

    PS. A feature I would very much like to see in RB is the ability to find and
    replace text in RAP functions, or even better to be able to export and
    import all the RAP functions of a Report in a whole text, so that I can edit
    them as a whole in another editor.

  • edited November 2006

    - creating reports in code is no different than creating reports via the
    designer. The designer is essence a visual layout tool that is creates the
    report in code for you.

    - simples way to use an existing report as a subreport is to save the report
    .rtm and then load it as a subreport. You can do this via the designer or
    programmatically.

    - the alternative for using an existing report as a subreport, is to use a
    technique we call 'reference subreports' in which the subreport.Report
    property references an external TppReport instance. This is tricky and can
    cause AV's in the destroy process, unless you follow the technique shown in
    this example

    www.digital-metaphors.com/tips/SubReference.zip

    - This example shows how to iterate over RAP event-handlers and modify the
    program text.

    www.digital-metaphors.com/tips/RAPIterateOverEventHandlers.zip



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.