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

Master/detail (one-to-one) without subreport?

edited September 2002 in General
Do I need to use a subreport if there is only one record in
the detail dataset?
I have a lot of datasets that are connected to other datasets
through one-to-one relationships. I just want to display a single
field of the detail dataset, and it seems unnecessary to use
a subreport for that. I've looked in the manual but all examples
assume that there are more than one record in the detail dataset
for each given record in the master dataset.
Have I missed something? It seems to work to just connect the detail
field to its detail pipeline.

What happens if there actually are more than one corresponding record
in the detail dataset? Is it defined what record will display if the
field is accessed in the master report, or will I get a random one?

Regards,

Örjan Råberg

Comments

  • edited September 2002
    You could use an inner join to create a single dataset. Then all of the
    fields will be available from both tables in one datapipeline. You don't
    need to use a subreport in this case. You can create a group around the key
    linking field if you want to control the printing of the data using a group,
    ie. start new page or keep together. If there is more than one "detail"
    record in the joined dataset, then you will have two detail bands printed in
    your group. Use the group header band to display the "master" data and the
    detail band to display the "detail" data.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Unfortunately I cannot use a join since my datasets are not based on SQL.
    The datasets (TBoldDataSet) are wrappers around lists in the object
    framework Bold for Delphi and they do not support join. We have created DADE
    extensions to make the datasets available in ReportBuilder, and it works well.

    I would like to know what happens if I connect e.g. a DBText control in
    the master report to a field in a detail pipeline. Will it work, or am I
    just having luck that it seems to work?

    Regards,
    ?rjan R?berg


  • edited September 2002
    If you have master detail datasets, then just use a subreport to print the
    detail data. You can't guarantee that you'll have only one detail record.
    If you know that you'll only ever want to print the first detail record for
    every master, then you can reference the detail datapipeline on the data
    aware control in the master record as you are doing. When the master data
    pipeline traverses to the next record, the detail datapipeline moves to its
    first record for the master dataset. This is normal lookup behavior. If you
    don't use a subreport, then the detail datapipeline will just sit there and
    no detail records will get traversed beyond the first detail for the master.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.