Second call PrepareReport raise exception

edited 4:52AM 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 4:52AM
    Create small demo project with problem and send it to support@fast-report.com or attach it here
  • edited 4:52AM
    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