Jump to content

Fastreport Refresh


TimPrior

Recommended Posts

Hi

I'm having a little problem using Fastreports in an UniGui application.

Firstly I filter the dataset using a unique code based on the pupil i want to print out. Then I export the Fastreport results as a PDF.

On the first networked computer I run the report for PupilA and I get a Pdf with PupilA information on it. On a second networked computer I run the report for PupilB but the resulting Pdf shows me PupilA s information instead of PupilB. (this only happens if I still have PupilA details still on the first computers screen).

Im not refreshing FastReports somewhere along the line.

My code is here

procedure TFmPrintOut.PrepareAndShow(Report: TfrxReport; Exp: TfrxPDFExport);
var
  AUrl : string;
begin

  Report.PrintOptions.ShowDialog := False;
  Report.ShowProgress := False;

  Report.EngineOptions.SilentMode := True;
  Report.EngineOptions.EnableThreadSafe := True;
  Report.EngineOptions.DestroyForms := False;
  Report.EngineOptions.UseGlobalDataSetList := False;

  Exp.Background := True;
  Exp.ShowProgress := true;
  Exp.ShowDialog := false;
  Exp.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', AUrl, True);
  Exp.DefaultPath := '';

  Report.PreviewOptions.AllowEdit := False;
  Report.PrepareReport;
  Report.Export(Exp);

  UniURLFrame1.URL := AUrl;
end;
 

 

procedure TFmPrintOut.UniFormBeforeShow(Sender: TObject);
var
  FRp : TfrxReport;
  FXp : TfrxPDFExport;

begin
 try

    FXp := TfrxPDFExport.Create(nil);
    try

      DmReports.QuPlcByPupil.filtered := false;
      DmReports.QuPlcByPupil.filter := '[PUPIL CODE] = '+quotedstr(DmPlcPupils.QuPupilListPupilCode.AsString);
      DmReports.QuPlcByPupil.filtered := true;
      FRp.LoadFromFile(UniServerModule.FilesFolderPath+'\reports\PupilPlcAll.fr3');
      PrepareAndShow(FRp, FXp);

    finally
      FRp.Free;
      FXp.Free;
    end;
  finally
  end;

end;
 

Any ideas on what Im doing wrong?

Thanks for all your help

 

Link to comment
Share on other sites

sorry here is my code again. for some reason i deleted the part where I created the report. Still have the same problem

 

procedure TFmPrintOut.PrepareAndShow(Report: TfrxReport; Exp: TfrxPDFExport);
var
  AUrl : string;
begin

  Report.PrintOptions.ShowDialog := False;
  Report.ShowProgress := False;

  Report.EngineOptions.SilentMode := True;
  Report.EngineOptions.EnableThreadSafe := True;
  Report.EngineOptions.DestroyForms := False;
  Report.EngineOptions.UseGlobalDataSetList := False;

  Exp.Background := True;
  Exp.ShowProgress := true;
  Exp.ShowDialog := false;
  Exp.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', AUrl, True);
  Exp.DefaultPath := '';

  Report.PreviewOptions.AllowEdit := False;
  Report.PrepareReport;
  Report.Export(Exp);

  UniURLFrame1.URL := AUrl;
end;
 

 

procedure TFmPrintOut.UniFormBeforeShow(Sender: TObject);
var
  FRp : TfrxReport;
  FXp : TfrxPDFExport;

begin
 try
    FRp := TfrxReport.Create(nil);
    FXp := TfrxPDFExport.Create(nil);
    try

      DmReports.QuPlcByPupil.filtered := false;
      DmReports.QuPlcByPupil.filter := '[PUPIL CODE] = '+quotedstr(DmPlcPupils.QuPupilListPupilCode.AsString);
      DmReports.QuPlcByPupil.filtered := true;
      FRp.LoadFromFile(UniServerModule.FilesFolderPath+'\reports\PupilPlcAll.fr3');
      PrepareAndShow(FRp, FXp);

    finally
      FRp.Free;
      FXp.Free;
    end;
  finally
  end;

end;

Link to comment
Share on other sites

Hi

no sorry Exp.Showprogress := false doesn't solve the problem. I have noticed that the sample freport thats included with UNIGUI suffers from the same problem. If you select Customer Information as a Report and ALFKI as a Report ID and let it create a PDF. When you run it on a second computer choose the same report but a different Report ID example WOLZA the pdf will display ALFKI.

 

Tim

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...