Home General

create multiple reports at the same time

edited April 2011 in General
Hi,

I need to create multiple reports at the same time.

I've tried to create a print-method in a datamodule, and call it several
times, something like that:


// Print function in datamodule
procedure Tdm1.printTest;
var
p : TppReport;
begin
p := TppReport.Create(self);

randomize;
p.Template.FileName := 'C:\Reports\Personalliste.rtm';
p.Template.LoadFromFile;

p.BackgroundPrintSettings.Enabled := True;
p.BackgroundPrintSettings.Active := True;

p.ShowPrintDialog := False;
p.ShowCancelDialog := False;

p.DeviceType := dtPDF;
p.TextFileName := 'C:\test'+IntToSTr(random(100))+'.pdf';
p.Print;

p.Free;
end;





// call print method from main form
procedure TForm1.Button1Click(Sender: TObject);
begin
dm1.printTest();
end;




This doesn't work - it just happens nothing (even no error).
Could you give me a pointer how this could be don?
Thank you very much!

Comments

  • edited April 2011
    Hello,

    Which version of ReportBuilder and Delphi are you using?

    I do not see anything wrong with your code below. If you trace into the
    printTest routine, does the Report.Print call occur? Try commenting out
    the BackgroundPrintSettings and see if that changes anything.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Hi Nico,

    I'm using RB 12.04.

    Yes, I've traced the printTest routine, and the call does occur.

    When commenting out the BackgroundPrintSettings, the report is generated
    as expected.

    Greets,
    Ben


    Am 19.04.2011 15:11, schrieb Nico Cizik (Digital Metaphors):
  • edited April 2011

    1. You need to place the Report on the DataModule at Delphi design-time or
    use the DataModule.OnCreate event to create it in code. The RB
    BackgroundPrint process will make an instance of the datamodule for each
    print request.

    2. Make sure you a provide a thread-safe container environment in which the
    report can execute. Check out the RBuilder Help topic for TppProducer
    BackgrounPrintSettings for details.

    3. Background print requests in processed in a queue, they are printed one
    at a time. The feature is designed to generate reports in a background
    thread, but not multiple reports at the same time. :)


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2011
    Hi Nard,

    Yes, when I place the Report on the DataModule it works, this way i
    tried it first.
    But as you mentioned in point 3, the reports are printed one at a time,
    and not simultaneously. This was thre reason why I started to create the
    report at runtime.

    Do you have an idea how to create the reports simultaneously?
    I would be very thankfull if you could give me some help on this - we
    really need this feature.

    Thank you very much!
    Ben


    Am 19.04.2011 18:02, schrieb Nard Moseley (Digital Metaphors):
  • edited April 2011

    RB Server Edition can be used to implement a multi-threaded server solution.
    You might download that and evaluate it.


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2011
    > Do you have an idea how to create the reports simultaneously?

    Are you looking to create 3 different reports at the same time or 3 copies
    of the same report?

    Ed Dressel
    Team DM
  • edited April 2011
    Hi Ed,

    I want to create 3 different reports at the same time...
    Thanks,
    greets ben


    Am 20.04.2011 18:48, schrieb Edward Dressel [Team DM]:
  • edited April 2011
    Is there a a sample somewhere how to accomplish this using RB Server?
    Thank you!


    Am 20.04.2011 18:09, schrieb Nard Moseley (Digital Metaphors):
This discussion has been closed.