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

Basic Report not working properly

edited August 2002 in DADE
I have been using Report Builder for a while now and have been very happy
with it, however i have come across a problem now i have filled up my
database a bit.
I have an Accounts table and a Contacts table which have a relationship on
the AccountNo field.

What i am doing is (at runtime), going to the data tab and creating an
Accounts dataview containing all the Account fields using the Query Wizard.
Now i create a Contacts dataview containing all the Contacts fields with the
Query wizard.
I now drag the AccountNo fields from the Contacts Dataview and drop it on
the AccountNo field on the Accounts dataview.

Now a go to the Design tab and drop a DBText in the detail section and link
it to the Accounts dataview and set it to the 'Account Name' field
Now i drop a subreport and link it to the Contacts dataview
I go to the subreport tab and drop a DBText which i link to the 'FullName'
field.
Now when i do a Preview everything is fine but is obviously out of order.

Here is the problem !!!!!!!!!!!
Now i go back to the Data Tab and select the Sort on the Accounts dataview.
I double-click the 'Account Name' field which brings it to the bottom pane.
Now when i preview, i get all of the Accounts sorted correctly but some of
the Contacts for certain accounts are not included in the Report.
The strange thing is that it is always the same Accounts that are missing
their Contacts.
I have been at this problem for hours now, so i am hoping someone could give
me some help please.
I am using Delphi5 Enterprise and Report Builder 6.03
I am using DBISAM and ASTA.
When working Offline, the Report gets it's data directly from a local DBISAM
database and when working Online i am connecting to the main DBISAM database
via the daASTA plugin.
I have tried connecting both Online and Offline and i get the same results.
Many thanks
John

Comments

  • edited August 2002
    In the dataview's link dialog, there is an option at the bottom to show
    master records when no details exists. The default is to not show master
    records when no detail record exist for that master. If this doesn't help,
    then check the SQL that we are generating. Ctrl-click over the dataviews
    and copy this SQL into a DBISAM query. What does this SQL show in a TdbGrid
    on a form?


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited August 2002
    The SQL created when i first link the Contacts to Accounts (No sorting) is
    just Select ('Whichever fields i have selected' from Accounts) and
    Select ('Whichever fields i have selected' from Contacts).
    As i say, this report will print all the Accounts and Contacts correctly.
    It is only when i choose to Sort the Accounts on the AccountName field that
    i get the 'Order By Accounts.AccountName' at the end of the Accounts SQL and
    more bizarrely i get
    "INNER JOIN "Contacts.dat" Contacts ON
    (Contacts.AccountNo = Accounts.AccountNo)
    ORDER BY Accounts.AccountName, Contacts.AccountNo" on the end of the
    Contacts dataview.
    Now if i run this query using my DBISAM tool (like Database Desktop) then i
    do get the records i am expecting.
    They are just not getting displayed in a print.
    Any other ideas ?

    BTW, i have now got the Accounts without Contacts being printed thanks to
    your advise about the Link View.

    John



  • edited August 2002
    The detail magic SQL should differ from the SQL that you get on the SQL tab
    of the dataview. The magic SQL is the actual SQL that is generated in order
    to get the detail dataset as ordered by the master dataset. The SQL tab's
    SQL is just the SQL which would represent the dataview if it were not linked
    and was just a simple query.

    Can you take ASTA out of the picture and just use a DBISAM directly in the
    Data workspace? There is a daDBISAM Dade plugin available from a link on our
    website. If you can reproduce the problem without ASTA involved, send me the
    two DBISAM tables (or create the report using DBDEMOS paradox tables) and
    the report and we will look to see what is wrong. Please send the example to
    support@digital-metaphors.com


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited August 2002
    Will do. You should get it sometime early next week, if i haven't sorted it
    out by then.

    Thanks
    John


This discussion has been closed.