Second call PrepareReport raise exception

edited 12:02PM in FastReport 4.0
I need to create 2 reports (second is same as first, but has some hidden fields). First report created normally. But when I call frxReport.PrepareReport second time, i get exception in frxEngine (callStack shows to function FlagsToName). I can't find this error because have not sources of frxEngine.

Then I try to not to hide fields and prepare copy of first report (just call PrepareReport second time after first call), and got same exception again.

Has someone same problem? How to solve this issue?

Comments

  • gpigpi
    edited 12:02PM
    Create small demo project with problem and send it to support@fast-report.com or attach it here
  • edited 12:02PM
    I found the solution. Exception showed if TfrxDBDataset.Name = TfrxDBDataset.UserName (but not in any cases\any times).
    procedure TfraReport.AddReportDataset2(var AQCBand: TfrxBand; ADataSet: TOracleDataSet);
    var
      FRDataSet: TfrxDBDataset;
    begin
      FRDataSet := TfrxDBDataset.Create(Self);
      FRDataSet.DataSet := ADataSet;
    
    
    //  FRDataSet.Name := AQCBand.Description;
      FRDataSet.Name := AQCBand.Description + '_FastReportNeedsDifferentName'; // the solution is to use different names for Name and UserName
      FRDataSet.UserName := AQCBand.Description;
    
    
      frxReport.DataSets.Add(FRDataSet);
      frxReport.EnabledDataSets.Add(FRDataSet);
      if AQCBand is TfrxDataBand then
        TfrxDataBand(AQCBand).DataSet := FRDataSet;
    end;
    

    In this redaction of code i have no exceptions.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.