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

Multiple Datasets - incorrect results!!

edited July 2002 in General
Please HELP !!!

We are users of the product and have been for some time. Currently on 6.01
live 6.03 test enviornment.

We have a number of reports that use linked datasets. We have given the
client an end-user reporting solution based upon your examples.

Database is Interbase version 5.5.

We think we may have found a problem with summing in linked datasets.

Our test is as follows :

We have a dataset with a table called tasks with a task_id field (unique).
We add another dataset with tasks also in this dataset and link on task_id.

We now assume that all records should match as we are using the same table
twice.

We have a report with a summary band and put two dbcalc components one to
add up task_id in dataset 1 the other to add up task_id in dataset 2.

The two values should be the same. They are not. We have no sorting on
either dataset. If we change sorting we get different results every time.

If we create a storedproc outside of this it works OK. We have also done
tests in a new app using mutiple queryobjects and linking them on the
Pipeline. Same problem. If we get the data out using just non RBuilder comps
we get the correct answer.
We have proven that a database is OK.

We also get the problem when using a completely diffent database.

The reason for the strange test is because we have a lot of financial
reports doing more complex things than above. After some spot checks on
these reports we found that the data was wrong although if we get the data
bit by bit manually it works.

Is their a bug! This is critical to our client as they bill based on a lot
of these reports.

Comments

  • edited July 2002
    I have the same problems using interbase 5.5, RB 6 Delphi 5. However I have
    narrowed it down a bit and it is very easy to reproduce the problem. Using a
    small table say 'The_Names' for example. Two fields Name_ID and The_Name.

    Name_ID Integer
    The_Name varchar(100)

    Next populate the table with data. For example.

    Name_ID The_Name
    1 Peter
    2 Jane
    3 Robert
    4 John
    5 David
    6 Mike

    Make a report using two queries on the data tab.
    1st query
    Table = The_Names
    Fields = Name_ID, The_Name
    Sort = The_Name

    2nd query
    Table = The_Names
    Fields = Name_ID

    Now link the two together by dragging "Name_ID" from query2 to query1.
    (since this is the same table you should always have corresponding records).

    Now use the report wizard to make a new report. Select all the fields from
    query1 then press finish.

    Select Report, Summary from the menu.

    Place two DBCalc's in the summary band. Set one to sum up Name_ID for query1
    and the other to sum up Name_ID for query2.
    Correct me if I am wrong but you should get the same answer (21 in this
    example) in both DBCalcs. I do first time round.

    Now change some of the data so that some of the names are the same. Eg
    change Robert to Jane. Now re-run the report (make sure that it refreshes by
    moving a component on the report by a couple of pixels). I get different
    results now in the two DBCalcs even though they are linked on Name_ID and
    not The_Name. This is not what I expect.

    Am I missing something?

    Mark Kemish

  • edited July 2002
    I reproduced your example by following the steps below but was not able to
    reproduce the problem. The sum came out to 21 in both cases. What were the
    sums you got the second time around? The only known problem that causes
    DBCalcs to not calculate correctly has to do with occasions when the summed
    component hits the bottom of the page and is forced to print on the
    following page, but has already been included in the DBCalc sum. Can you
    send me your example to run here just in case you are doing something
    different to set this up? You can send this to
    support@digital-metaphors.com.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    Alexander

    Thanks for your reply

    Sorry I have realised that I have missed a step out and that was record 2
    "Jane" should be changed to "Jane " with a space after the name. Then the
    summed result gives 18 not 21 if you change "Robert" to "Jane" (without a
    space). I had added this space by accident initially and did not realise
    that it was there and was part of the problem. If you put in a space I am
    sure you should see the same results as me. I can now reproduce this 100% of
    the time.

    Thanks

    Mark Kemish

    FCO

    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited July 2002
    Hi Mark,

    Still cannot reproduce it. RB6.03, tested with D5 and D6 with Interbase.
    Record 2 is "Jane " and record 3 is "Jane". Both DBCalcs sum out to 21. Can
    you please send your project to support@digital-metaphors.com.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    Hi Alexander

    I understand from a forwarded email I received that you have now reproduced
    this. If not would you still like me to send you a database and an RTM?

    Mark
    "Alexander Kramnik (Digital Metaphors)" wrote
This discussion has been closed.