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

End-User, LoadDatabase & Events

edited April 2007 in End User
Hi,
some people talked about when we lost the events with a loadDataBase in
End_User application.

My my is the same, but i didnt undestend how work.


My case is:

i have a ppVariable in my ppReport and i change the value in aftherPrint on
HeaderBand.

when i change something on ppDesigner i lost my event.

So, how i load my event again.

I need a real example.

Please.

tks.

Rafael Escher Guarasemini
Brazil

Comments

  • edited April 2007
    Rafael,

    Where are these events defined (RAP or Delphi)? If they are defined in
    Delphi, you will need to reassign the events after the template has been
    loaded in the Template.OnLoadEnd event. If the events are coded in RAP,
    there should be no problem as all event code will remain local to the
    template.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2007
    i defined my events in Delphi.
    Can you put a example here ?

    tks

    Rafael Escher Guarasemini
    Brazil
  • edited April 2007
    Hi,
    this is my example code. Whats wrong ?

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppReport1.Template.DatabaseSettings.Name := 'rbTestes';
    ppReport1.Template.DatabaseSettings.NameField := 'rb_Name';
    ppReport1.Template.DatabaseSettings.TemplateField := 'rb_Template';
    ppReport1.Template.SaveToDatabase;
    end;

    procedure TForm1.HeaderAfterPrint(sender: TObject); - create by me
    begin
    ppVariable1.Value := 'escher';
    end;

    procedure TForm1.ppHeaderBand1AfterPrint(Sender: TObject);
    begin
    ppVariable1.Value := 'escher';
    end;

    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
    ppReport2.Template.DatabaseSettings.Name := 'rbTestes';
    ppReport2.Template.DatabaseSettings.NameField := 'rb_Name';
    ppReport2.Template.DatabaseSettings.TemplateField := 'rb_Template';
    ppReport2.Template.LoadFromDatabase;
    ppReport2.Template.OnLoadEnd := HeaderAfhetPrint;

    ppReport2.Print;
    end;

    why the ppVariable didnt change on bitbtn1 ?

    tks for all.

    Rafael Escher Guarasemini
    Brazil
  • edited April 2007
    Rafael,

    Your going to want to assign the AfterPrint event inside the OnLoadEnd event
    of the template, not assign the OnLoadEnd event to run the AfterPrint
    code...

    ppReport2.Template.OnLoadEnd := TemplateLoadEndEvent;

    procedure TemplateLoadEndEvent(Sender: TObject);
    begin
    ppReport2.HeaderBand.AfterPrint := HeaderAfterPrint;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.