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

OnCalcFields event

edited February 2014 in General
Hi,

We have upgraded form RbPRo 11.08 to 15.02. (And from Delphi XE to XE4)

We now have an issue with some reports regarding calculated fields because
we miss some OnCalcFields events. The layouts and queries are not changed.
I have traced it to changes in ppDBPipe.pas:

procedure TppDBPipeline.GotoFirstRecord;
begin
if (FDataLink.DataSet <> nil) and not(FDataLink.DataSet.Bof) then
FDataLink.DataSet.First;

here the test on FDataLink.DataSet.Bof is added. So TDtataSet.First is not
called on an empty dataset, but TDataSet.First does more then moving to the
first record. It also calls OnCalcFields! When I remove the test everything
seems OK.
(In TppDBPipeline.GotoLastRecord there is the same test on TDataSet.Eof)




Regards,

Max Paay
Quadrant Software bv.
The Netherlands

Comments

  • edited February 2014
    Max,

    I performed a simple test with XE5. I created a form with an AdoQuery and
    implemented OnCalcFields. In a Button OnClick I call DataSet.Open and
    DataSet.First. For an empty dataset, OnCalcFields is never called. For a
    dataset with records, OnCalcFields is called twice - once for Open and once
    for First.

    That DBPipeline optimization was added Oct 2011 and no one has reported any
    issues.



    Best regards,

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2014
    Nard,

    Thanks for your time. Then it appears to be dependent on the database
    layer. We are using ODBC (based on the old ODCBExpress modified by us for
    Delphi XE4 and unicode). It calls OnCalcFields on an empty dataset somewhere
    from its overriden InternalFirst. But TCustomADODataSet.InternalFirst starts
    with same test as the DBPipeline optimization and does nothing on an empty
    set. I have to assume that embarcadero has it right and our code depends on
    a bug in another component.
    BTW: TDataSet.First (a non virtual) does things on an empty set, ie it will
    fire OnBeforeScroll and OnAfterScroll.

    Thanks again,

    Max Paay
    Quadrant Software bv.
    The Netherlands
This discussion has been closed.