Jump to content

Fastreport C++


GeniSoftware

Recommended Posts

How can this be done in c++? Can you give a c++ code sample? Thanks

FastReport is a popular reporting tool for Delphi and C++ Builder. In the previous section we described general guidelines for using FastReport components in a uniGUI application. Some recent findings have shown that special care must be taken to ensure that FastReport runs in a compatible mode with uniGUI and its multi-threaded environment.

 

Avoid using FastReport global dataset list

 

Global dataset is a collection used by FastReport in VCL applications. This collection should be avoided in uniGUI, otherwise its use can lead to severe issues such as stack overflow and immediate server crash. In the previous section we mentioned that the following setting must be applied to avoid global dataset usage:

 

  Report.EngineOptions.UseGlobalDataSetList := False;  // Do not keep a global list of a datasets

 

Developers must make sure that this setting is applied right after the TfrxReport component is created. If your TfrxReport component is on a Form or a DataModule, uniGUI will provide a handy method to do this. Go to MainModule, click on the OnNewComponent event and add the following code:

 

procedure TUniMainModule.UniGUIMainModuleNewComponent(AComponent: TComponent);
begin
  if AComponent is TfrxReport then
  begin
    (AComponent as TfrxReport).EngineOptions.UseGlobalDataSetList := False;
  end;
end;

 

The previous code will ensure that each new instance of the TfrxReport component will have the correct setting for its UseGlobalDataSetList property.

 

If you create the TfrxReport component in code, modify the setting manually:

 

// always create TfrxReport component with an owner

  f := TfrxReport.Create(Self);
  try
    f.EngineOptions.UseGlobalDataSetList := False;
    f.EngineOptions.SilentMode := True;
    f.EngineOptions.EnableThreadSafe := True;
    f.EngineOptions.DestroyForms := False;
    f.LoadFromFile(UniServerModule.FilesFolderPath + RepName + '.fr3');
 
   // generate report here
 
  finally
    f.Free;
  end;

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...