Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Report Explorer loads too long...

edited December 2003 in End User
Hi,
We have a client side and a remote server side - database with reports.
Because of the fact that server is situated in the distance, whenever the
Report Explorer starts loading it takes up to 1 minute to load.
If you close Report Explorer without doing anything and open it again - it
will load in an instant. But once you print a report with it (one is enough)
and close the Report Explorer, it once again takes about a minute to open
up.
So the question is:
How can I load it into the memory and use it from there so that I would only
have to wait a minute once, not every time I open Report Explorer to print
another report.

Thank you,
MB.

Comments

  • edited December 2003

    Try creating the the report explorer form and opening the rbItem and rbTable
    datasets. You can create the form and then later call ReportExplorer.Execute
    to show it.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    No, that didn't help. I actually have both datasets (rbItem and rbFolders)
    opened in the design time, so I don't need
    to open them in the run time. Also creating another report explorer form
    instance in the process and working with it
    results in having the same problem.

    My further research showed that the main slow down occurs in the
    ReportExplorerUnit in the LoadStateInfo procedure
    on the following string:
    FListView.FolderId := lIniStorage.ReadInteger('Explorer Form State',
    'Selected Folder', 0);
    It happens when you try to write something into the FListView.FolderId
    property.

    There in the ppRptExp.pas "GetItemsForFolder" procedure is being called
    which is the reason of the slow down.
    Unfortunately I couldn't research it further because I couldn't put a
    breakpoint inside the ppRptExp.pas even when I tried
    to copy the file into my main project directory.

    What do I need to do now?

    Thank you,
    MB.

  • edited December 2003

    Modify your Delphi library path from RBuilder\Lib to RBuilder\Source, then
    you can trace the code in the Delphi debugger.

    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Deepest analyse showed that the main slowdown on your part occurs in the
    following code (ppDBPipe unit):

    function TppDBPipeline.TraverseBy(aIncrement: Integer): Integer;
    begin
    if (FDataLink.DataSet <> nil) then
    Result := FDataLink.DataSet.MoveBy(aIncrement)
    else
    Result := 0;
    end;

    on the following string:
    "Result := FDataLink.DataSet.MoveBy(aIncrement)"

    There control goes to Borland. As far as I could trace it the main slowdown
    in their code occurs at the
    "function TBDEDataSet.GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck:
    Boolean): TGetResult;"
    in "DBTables" unit on the following line of code:

    case GetMode of
    ....
    gmNext:
    Status := DbiGetNextRecord(FHandle, dbiNoLock, Buffer, @FRecProps);

    Since they do not provide the source for BDE calls, I couldn't trace it
    deeper, but I don't think it would have much
    sence. I doubt that I can optimize their code.

    In sum: tracing the code didn't help.
    Do you have any more ideas?

    Thank you,
    MB.

  • edited December 2003
    Oh yeah, if it helps - I have some code in the Template.OnLoadStart and
    Template.DoOnLoadEnd events.
    Further testing showed that the slowdown on the second loading of
    ReportExplorer occurs if the OnLoadStart event contains the following
    string:
    "DataModuleUnit.ContinueLoading:=true;"
    But I have absolutely no idea how could this simple assignment affect the
    ReportExplorer loading process, especially considering the fact that I have
    few alike strings there. Most probably this is not directly related.
    Well, it might still help to solve the problem.

    Thank you,
    MB.

    P.S.: Here is the source code of my Template.OnLoadStart event. Just in
    case..

    procedure TReportComponentsDialog.DoOnLoadStart(Sender: TObject; Stream:
    TStream);
    Var
    SqlObject :TdaSQL;
    i,j :Integer;
    begin
    SeparateDialog:=false;
    CurRepId:=ItemsTable.FieldByName('ITEM_ID').AsVariant;

    Case DataModuleUnit.LastAction of
    roPrint,roPreview:
    begin
    ReportComponentsDialog.Editing:=true;
    ReportComponentsDialog.ParametersPipeline.Visible:=true;
    DataModuleUnit.ContinueLoading:=true;
    if ReportExplorerDialog.HasParameters then begin
    ReportFillParamsDialog.ShowModal;
    end;
    if not DataModuleUnit.ContinueLoading then begin
    Abort;
    end;
    end;
    roDesign,roOther:
    begin
    Editing:=true;
    ParametersPipeline.Visible:=false;
    if ReportExplorerDialog.HasParameters then begin
    ReportFillParamsDialog.CurRepId:=ReportExplorerDialog.CurRepId;
    ReportFillParamsDialog.ReloadData;
    ParametersPipeline.Visible:=true;
    end;
    ReportParametersDialog.FormShow(nil);
    end;
    end;

    ParamsReload;
    ExecuteSP;
    if DataModuleUnit.LastAction <> roOther then begin
    if not (DataModuleUnit.LastAction in
    [roPrint,roPreview,roSilentPreview]) then begin
    ReportSqlListDialog.ShowModal;
    end
    else begin
    ReportSqlListDialog.LoadData;
    end;
    GeneratePipelines;
    DataModuleUnit.LastAction:=roOther;
    end
    else begin
    GeneratePipelines;
    end;
    TempReport:=TppReport(TppReportTemplate(Sender).Report);
    TempReport.NoDataBehaviors:=[ndBlankReport];
    end;

  • edited December 2003

    Try running one of the RBuilder\Demos\EndUser Databases examples that does
    not contain any event handler code.

    I would think that the biggest delay in initializing the report explorer
    form is going to be opening the folder and item datasets and initializing
    the treeview and list view. But this is not related to loading any reports
    from the database.

    I do not know what DataModuleUnit.ContinueLoading:=true is.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.