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

Inconsistent DcCalc calculations

edited January 2014 in General
Hi Guys

An odd problem has presented itself to us of late.

We use Delphi7, ReportBuilder15 and MySQL database

Our app does a simple date sensitive query and presents us with a report of
transactions including a NET and VAT totals for the selected period. The
report uses the DbCalc component to auto-calc the NET & VAT summations. We
had noticed that the totals were not consistent for a given date range so we
added code calculated totals to the app form which are consistent. It gets
weirder... We originally noticed the discrepancy on a new Windows 8 laptop.
We then popped the app onto a Windows 2008 Server and run it via Remote
Desktop...the app and report give consistent values and all is well always.

We then run the app (exactly the same application just copied from pc to pc)
on another PC this time an XP desktop and again obtain inconsistent
summations between the DbCalc and the calculated values....

Digging further into the contents of the report, when an inconsistency
occurs we have noticed that a spurious entry exists in the report list that
is a duplication of one of the correct transactions.

Do you have any ideas what may be causing this? We have an Adobe file that
clearly shows the app calcs and the report calcs across the three pc's if
this would help?

Thanks

Glenn

Comments

  • edited January 2014
    Hi Glenn,

    We have not heard of an issue like this before with RB 15. Please
    create a simple example that demonstrates this behavior and send it to
    support@digital-metaphors.com in .zip format and we'll take a look at
    what might be happening.

    Best Regards,

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

    We have sent a zip file containing a sample app.

    thanks

    Glenn

  • edited May 2014
    Hi Guys

    The issue described had appeared to disappear, but has now occurred again in
    a completely different application using different database tables (this
    time Advantage DB not MySQL) and this time we have found a solution (if not
    the cause) but feel it needs reporting to you.

    We found from a post on 27th March 2014 that if we tell a report to only use
    only single page option by calling:
    ppReport1.PreviewFormSettings.SinglePageOnly:=True; Then this fixes
    occasions where our application hangs for some users when printing.

    Today we were making some code adjustments to a long existing routine and
    report and noticed again the issue where additional transactions were
    appearing in the screen report that did not appear in the DbGrid component
    (we use exactly the same SQL component to display data in the DbGrid and the
    ReportBuilder report).

    After much research we found that if we set the report to single page, all
    is well and that firing the report 20 times in succession gives consistent
    results, if not then additional entries appear apparently randomly (and are
    calculated by the DbCalc component in the report!) about 7 times out of 10.

    The way we feel at the moment, we need to set all reports in our application
    to single page as a matter of urgency...Can this be done?

    We look forward to your feedback, and suggestions as to why we are
    experiencing this.

    Thanks

    Glenn



  • edited May 2014
    Hi Glenn,

    What you are experiencing is a common result of using the Multi-Page
    viewer with ReportBuilder and sharing datasets with other controls in
    your application.

    The easiest workaround is to set SinglePageOnly to True. Another is to
    disable all controls connected to the shared datasets before calling
    Report.Print.

    DataSet.DisableControls;

    try
    Report.Print;

    finally
    Dataset.EnableControls;
    end;

    Finally, the best solution is to keep all report-related datasets
    separate from any outside controls such as DBGrids etc. This will
    ensure ReportBuilder has its own space to work and will not be
    interfered with while generating.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2014
    Yep ok Nico, thanks I understand.

    Is there a quick/easy way for us to ensure that all developer designed RB
    components (ie not user editable by user...where this is the case we will be
    able to add SinglePage in the code after loading), are automatically a) set
    to and b) new ones defaulted to, SinglePage in our applications? (otherwise
    we will have to scroll through hundreds of forms and do each manually!)

    Cheers

    Glenn



  • edited May 2014
    Hi Glenn,

    You can use the Report.Template.OnLoadEnd event to ensure code is
    executed after the template is loaded but before the report is
    generated. See the following article on using template events.

    http://www.digital-metaphors.com/rbWiki/Design/Templates/Using_Template_Events

    Best Regards,

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