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

Range check error

edited January 2012 in General
I have a report that worked fine in RB 10. Now in RB 14, it runs fine
the first time, but the second time it runs, I get a Range check error.
The preview window shows, and it has "Accessing data" in the lower left
corner, but nothing ever shows in the preview screen.

The error happens in unit ppUtils. The function is ppToMMThousandths.

How I can resolve this? I have another report that does the
same thing, but not all reports have this problem.

--

Comments

  • edited January 2012
    Some more information.

    The error happens in unit ppUtils, in function ppToMMThousandths on
    line 3818:

    Line 3818: Result := Round( ((Value / liDPI) / InchPerMM) * 1000)


    The call is made from unit ppCtrls, TppCustomText.CalcSpaceUsed. The
    line is 2304: liLineHeight := ppToMMThousandths(...)

    On the first pass, Value is like 20. When running the report the second
    time, Value is huge, something like 2140351488.


  • edited January 2012
    >I have a report that worked fine in RB 10. Now in RB 14, it runs fine

    seeing most of us aren't seeing it (or you would see a lot of posts on it),
    I would re-crete the problem in a demo and send that to DM.

    Ed Dressel
  • edited January 2012
    The Range Check error I get is not trapped by Report Builder, but
    rather the exception propogates to my application exception checker.

    In comparing the reports that worked with those that did not, I
    discovered that the Printer setting was set to Screen on the reports
    that did not work while the working ones had their printer set to
    default. Once I changed them to Default, then the reports previewed
    fine. In fact, they processed much faster.

    The other reports that were working fine had their printer set to
    default. If I switch them to Screen, then they give me the same Range
    Check error.

    So now I have to figure out why that is happening. Right now I am
    wondering if it might be related to me changing parameters in the
    OnPreviewFormCreate where I set WindowState to wxMaximized and
    ZoomSetting to zs100Percent.


  • edited January 2012
    Following is code I have which loads the report template and either
    opens the designer or prints. This was developed years back, since RB
    6. Is there a better way to do this now that might correct the issue I
    am having with printer destination set to Screen?


    procedure TEodSumForm.ppReport1PreviewFormCreate(Sender: TObject);
    begin
    ppReport1.PreviewForm.WindowState:=wsMaximized;
    TppViewer(ppReport1.PreviewForm.Viewer).ZoomSetting:=zs100Percent;
    end;

    ...
    EodSumForm.ppReport1.DumpCache;
    EodSumForm.ppReport1.Template.FileName:=ReportPath+RepFName;
    EodSumForm.ppReport1.Template.LoadFromFile;
    dmRep1.SetEmailVars(EodSumForm.ppReport1,'N');
    EodSumForm.ppReport1.OnPreviewFormCreate:=
    EodSumForm.ppReport1PreviewFormCreate;
    ppReport1.AllowPrintToArchive:=True;
    ppReport1.AllowPrintToFile:=True;
    if (OpenDesigner='Y') then
    begin {Hide Help Menu}
    EodSumForm.ppDesigner1.Menu.items[4].Visible:=false;
    EodSumForm.ppDesigner1.ShowModal;
    RefreshListBox;
    end
    else EodSumForm.ppReport1.Print;
    ...

    ===
  • edited January 2012
    Hi David,

    I do not see anything wrong with your code below. If possible, please
    send a simple Delphi application to support@digital-metaphors.com in
    .zip format I can run here that demonstrates the range check error and
    I'll take a look at it for you.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2012
    Hi Nico.

    I sent a test project. The test project does not show a Range Check
    error, but all the labels disappear after the first preview of the
    report. I guess the numbers generated in the test project are not
    large enough for a range check error, but clearly there is something
    wrong on subsequent runs of a report. A value is not getting reset
    after the first run if Printer is set to Screen.

    David.

  • edited February 2012
    Thanks David,

    I'll take a look at your example and get back to you via email as soon
    as possible.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.