Jump to content

dynamic report problem


jahlxx

Recommended Posts

Hi.

 

I've problems with loading reports dynamiclly, in ISAPI, no problem in stand alone.

 

This sentence don't work:

 

   frxReport1.LoadFromFile(UniServerModule.FilesFolderPath+'ltabla.fr3');
 

I get connection error, Retrying ..... n

 

And aplicarion hangs.

 

Any idea?

 

Thanks.

Link to comment
Share on other sites

Start like this :

 

      Frx:=TFrxReport.Create(nil);
      pdf:=TFrxPdfExport.Create(nil);
      try
            frx.Clear;
            frx.EngineOptions.DestroyForms         := False;
            frx.EngineOptions.SilentMode           := True;
            frx.EngineOptions.UseGlobalDataSetList := False;
            frx.EngineOptions.EnableThreadSafe     := True;
            frx.PrintOptions.ShowDialog            := False;
            frx.PreviewOptions.AllowEdit           := False;
            frx.ShowProgress                           := False;

            pdf.ShowDialog      := False;
            pdf.ShowProgress    := False;
            pdf.OverwritePrompt := False;
            pdf.Background      := True;
            pdf.EmbeddedFonts   := True;

            <You load and run the report here !! > ....................................................

 

  finally

    Frx.Free;

    Pdf.Free;

 end;

 

N.B.

1. TFrxDBDataSet  are not supposed to be thread safe so don't use then.

2. Put a Database connection in each report and transmit the connection parameters to it.

Link to comment
Share on other sites

  • 4 years later...
  • 2 months later...

My enviroment is : UniGui, UniDac, FastReport

I put the FastReport component on the DataModule.

Then in the private part of DataModule

private

   .............

              RCon:TFrxUniDacDatabase;  // You have to have the full FastReport license and install those components !

// With the report designer you add a connection object on the report. You name it DConn so it can be found by name later on.

// When you run the report first you do something like :

procedure TUniMainModule.DoReport(rname:string; <.... some parameters for the report >);
    var
                    pdf:TFrxPdfExport;

   procedure InitConn;
     begin
     RCon:=Frx.FindObject('DConn') as TFrxUniDacDatabase; 
     if Assigned(RCon) then
        begin
        RCon.Connected   :=False;
        RCon.Server          :=UniMainModule.Conn.Server;
        RCon.DatabaseName:=UniMainModule.Conn.Database;
        RCon.Username    :=UniMainModule.Conn.Username;
        RCon.Password     :=UniMainModule.Conn.Password;
        RCon.LoginPrompt :=False;
        RCon.Connected    :=True;
        end
        else ShowMessage('Connection ( DConn ) not existent ');
     end;


// Conn evidently being the DB connection object from the DataModule1.

// Then you run the report as shown in the first message.

  • Like 1
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...