Jump to content

threadtimer runtime


jahlxx

Recommended Posts

ok.

 

I read that topic before, and I think I understand.

 

Now I do this, and works fine, I can launch many reports at once, without any problem:

 

First, create the tread:

 

   xxth := tunithreadtimer.Create(libr);
   xxth.Enabled := false;
   xxth.Interval := 10;
   TUniThreadTimer(xxth).ontimer := exec_thread;
   xxth.Enabled := true;
 

 

And in the procedure exec_thread:

 

  exp := TfrxPDFExport.create(self);

  rpt := TfrxReport.Create(self);
  rpt.LoadFromFile(UniServerModule.StartPath +'files\rep\test.fr3');

  rpt.PrintOptions.ShowDialog := False;
  rpt.ShowProgress := false;

  rpt.EngineOptions.SilentMode := True;
  rpt.EngineOptions.EnableThreadSafe := True;
  rpt.EngineOptions.DestroyForms := False;
  rpt.EngineOptions.UseGlobalDataSetList := False;
  rpt.PreviewOptions.AllowEdit := False;
  rpt.ReportOptions.name := 'TEST';

  exp.Background := True;
  exp.ShowProgress := False;
  exp.ShowDialog := False;
  exp.FileName := UniServerModule.StartPath + 'files\tmp\' + xreport;
  exp.DefaultPath := '';

  rpt.PrepareReport;
  rpt.Export(exp);
 

 

This executes every report in a separated thread every time.

 

Can you see something wrong, and / or any point of improve?

 

Thanks.

Link to comment
Share on other sites

  • 4 weeks later...

No.

 

Connetions are inside every report, as explained in the following link. And works ok.

 

http://forums.unigui.com/index.php?/topic/9342-dynamic-report-problem/

 

 

 

Now, what I need, is to control the end of every separated thread.

 

With this, the sentence of insert, fails, because I try to use elements located in other form, and I don't know how to solve it.

 

   try
      rpt.PrepareReport;
      rpt.Export(exp);
   finally
      Sentences to insert records in database
   end;
 

Link to comment
Share on other sites

Hi.

 

for these sentences, I create in run time, the connection, the sql sentence, and so on.

 

and work until the execute sentence of the tquery:

 

starttransaction

insert ....

execute

commit

 

 

The execution of the app break at execute sentence

 

Any idea?

 

Thanks.

Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...