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

Occasionally getting "error reading data from the connection"

edited December 2014 in General
Hi,

when previewing reports the error "error reading data from the
connection" is displayed occasionally. We have ReportBuilder 15.04 and
the underlying database is Firebird.
The first question I'd like to ask is what are the possible causes of this?

I have read (e.g. here
https://groups.yahoo.com/neo/groups/firebird-support/conversations/topics/15921)
that this error might be because of multiple threads using the same
database connection. Furthermore, in a post on this newsgroup dated
9.5.2012, it's stated that: "The new RB 14 viewer generates all pages in
a background thread for efficient execution. This is necessary due to
the fact that unlike RB 12, multiple pages must be requested at the same
time. For RB 12, only a single page needed to be requested.
You can revert back to the RB 12 style viewer by setting the
PreviewFromSettings.SinglePageOnly property to True."

I'd like to set "Report.PreviewFromSettings.SinglePageOnly := True;" for
all existing reports to see if that helps. Is there any easy way to
accomplish that without modifying every single report (i.e. perform this
modification centrally in one place)? I have tried to do this in the
BeforePreview event as in this example:
http://www.digital-metaphors.com:8080/Plugins/Dialogs/Preview_Plugin,
but that recursively calls TppPrintPreview.Init until a stack overflow
is returned.

Any other suggestions about how to solve this error are also welcome.

Thanks in advance for any answers,
Jure

Comments

  • edited December 2014
    Hi Jure,

    Setting the Report.PreviewFormSettings in the BeforePreview will cause
    an infinite loop due to the fact that the preview is automatically
    updated when a property is set.

    You will want to set the Viewer.SinglePageOnly property to True inside
    the BeforePreview. This however still leaves the issue of the
    Multi-Page View buttons still showing. You will also need to manually
    hide them. This is not ideal, I will look at rearranging this code so
    it can be more elegantly done.

    procedure TMyPreviewPlugin.BeforePreview;
    begin
    inherited;

    //Force SinglePageOnly
    Viewer.SinglePageOnly := True;

    //Hide un-needed buttons
    SinglePageButton.Visible := not(Viewer.SinglePageOnly);
    TwoUpButton.Visible := not(Viewer.SinglePageOnly);
    ContinuousButton.Visible := not(Viewer.SinglePageOnly);
    ContinuousTwoUpButton.Visible := not(Viewer.SinglePageOnly);

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2014
    Hi Jure,

    Here are a couple of solutions:

    1. If loading templates from file/database use Report.Template.OnLoadEnd to
    set report properties.

    or

    2. Implement a utility routine, such as myInitialReport(aReport: TppReport)
    and then call the routine prior to calling report.Print. Or make a routine
    called myPreviewReport(aReport: TppReport) that initializes the properties
    and calls print.



    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2014
    Nico and Nard,

    thanks to both of you for your suggestions, I've implemented the ones
    Nico suggested. Hopefully it will solve the "error reading data from the
    connection" error.

    Thank you and regards,
    Jure

This discussion has been closed.