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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...