jahlxx Posted September 25, 2017 Share Posted September 25, 2017 Hi. Is possible to create a unithreadtimer in run time and assign a Timer event in run time too? If yes, how? Any code sample? Thanks. Link to comment Share on other sites More sharing options...
Sherzod Posted September 25, 2017 Share Posted September 25, 2017 Hi, First of all about the difference: http://forums.unigui.com/index.php?/topic/6457-difference-between-tunitimer-and-tunithreadtimer/&do=findComment&comment=32913 Link to comment Share on other sites More sharing options...
jahlxx Posted September 25, 2017 Author Share Posted September 25, 2017 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 More sharing options...
jahlxx Posted October 23, 2017 Author Share Posted October 23, 2017 Hi. Now everything works with FR, creating everything in runtime, and executing every report is separated threads. But, how can I control and know when a thread ends? Thanks. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 23, 2017 Administrators Share Posted October 23, 2017 Your method of creating reports is not safe. How about database connections? Are your report using Connection from MainModule? If Yes, it is not safe. Link to comment Share on other sites More sharing options...
jahlxx Posted October 23, 2017 Author Share Posted October 23, 2017 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 More sharing options...
jahlxx Posted October 23, 2017 Author Share Posted October 23, 2017 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 More sharing options...
jahlxx Posted October 25, 2017 Author Share Posted October 25, 2017 Hi. What I'm looking for is the way to store in a table the pdf generated. The user can launch more than one report simultaneously, and works perfect, but can't store in a table. Someone can help? Thanks. Link to comment Share on other sites More sharing options...
jahlxx Posted November 28, 2017 Author Share Posted November 28, 2017 Hi. Someone can help me in this? Thanks. Link to comment Share on other sites More sharing options...
alireza.rafii Posted April 25, 2020 Share Posted April 25, 2020 On 9/25/2017 at 6:52 PM, jahlxx said: s at once, without any problem: 3232 Link to comment Share on other sites More sharing options...
Sherzod Posted April 25, 2020 Share Posted April 25, 2020 1 hour ago, alireza.rafii said: 3232 ? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now