Home RAP

variable initialization rb 12

edited August 2010 in RAP

We've found that the variables created for example in the event
"ReportOnInitializeParameters" completed the report are not initialized.

This is correct because the rb version 7 is initialized all variables at the
end of the report.?


Edgar Britez


  • edited September 2010
    I don't understand the question.

    RB 9 introduced the Report.OnInitializeParameters event, prior to that the
    event did not exist.

    The Report.OnInitializeParameters event is working as designed.

    From the RBuilder help topic for TppReport.OnInitializeParameters....

    This event fires whenever a report is generated via a call to the Print
    method. This event occurs prior to the AutoSearch events. Use this event to

    - Define Report.Parameters[] and Report.AutoSearchFields[]
    - Set Parameter and AutoSearchField values.
    - Display a custom dialog that enables a user to enter parameter values.
    This is useful when not using the built-in AutoSearch feature.
    - Generate custom SQL that adds autosearch criteria.

    Set the Cancel parameter to True to cancel the report generation process.

    Nard Moseley
    Digital Metaphors

    Best regards,

    Nard Moseley
    Digital Metaphors
  • edited September 2010
    Sorry for my bad english.

    try to explain....

    I declared local variables for example en the event
    Report.OnInitializeParameters in RAP.
    I print the report
    then.... back to print a second time same report

    In second time the local variables are not initialized, are assigned the
    value first impression.

    In Report.OnInitializeParameters in RAP. declared

    var v_where:string;

    In first print asigned v_where := vwhere + 'where codigo = 1';

    result 'where codigo = 1';

    in second print v_where := vwhere + 'where codigo = 2';

    result 'where codigo = 1where codigo = 2';

    as if no re-define the variables in second time.

    for now we are solving empty initializing all variables defined. Example:
    v_where := '';

    but it is assumed that each time you run an event the local variables should
    be redefined.

    In RB7 did so well, but not in rb12, this is ok or is it a rb12 bug?

  • edited September 2010

    We tested multiple times with the same report and the
    same data and the report never releases the report variables.

    In the Event ReportInitialize on the report ,

    you can test this simple code :


    procedure ReportOnInitializeParameters(var aCancel: Boolean);

    var Var1 : String;


    Var1 := Var1 + ' Hellow ';




    The variable Var1 never releases.

  • edited September 2010

    could reproduce the problem?


    "Edgar Britez" escribi? en el mensaje
  • edited September 2010
    You need to initialize local variables - this is true for Delphi code and
    RAP code.

    Nard Moseley
    Digital Metaphors

    Best regards,

    Nard Moseley
    Digital Metaphors
This discussion has been closed.