Multi-threading

Top  Previous  Next

 

FastReport  can  operate independently in more than one thread, but there are some considerations:

 

- “TfrxDBDataSet” cannot be created in different  threads because the “global list” is used for searching and the dataset will always be taken from the first created “TfrxDBDataSet” (use of the global list can be switched off - it is active by default)

 

- if there are changes in object properties (for example Memo1.Left := Memo1.Left + 10 in script) during report execution then it must be remembered that during the next operation, if “TfrxReport.EngineOptions.DestroyForms = False” the report template will already have been changed and will need to be reloaded, or use “TfrxReport.EngineOptions.DestroyForms := True”. During renewal you can't use interactive reports from the thread because the script's objects are deleted after renewal, that is why in some cases it is better to use “TfrxReport.EngineOptions.DestroyForms := False” and renew the template on your own during the next build cycle

 

If required the global list which is searched for copies of “TfrxDBDataSet” can be switched off:

 

{ DestroyForms can be switched off, if every time a report is renewed

 from a file or from the current report }

FReport.EngineOptions.DestroyForms := False;

FReport.EngineOptions.SilentMode := True;

 

{ This property switches off the search of the global list }

FReport.EngineOptions.UseGlobalDataSetList := False;

 

{EnabledDataSets plays the role of a local list, it should be installed

before the template is loaded }

FReport.EnabledDataSets.Add(FfrxDataSet);

FReport.LoadFromFile(ReportName);

FReport.PrepareReport;