New Blog Post: PDF/A and Metadata

Removing report joins at runtime?

edited March 2003 in General
I have a report based on four tables, here is a rough description of the
tables:

Work Orders, contains work order information, a Contract Code and a Region
Code.
Contracts, contains information about a contract and a Contract Code.
Regions, information about a region and a Region Code.
Contract Regions, contains a link between Contracts and Regions (Region Code
and Contract Code).

I want a report to show, all Work Orders (regardless of Region Code) for all
Contracts within a specific Region. So if a Work Order is done in a
different Region, if the contract also covers that region the Work Order is
displayed.

The report I have done is a list of Work Orders, grouped by contract, joined
on the Contract Code to the Contracts table. The Contracts table is joined
to the ContractRegions table and a value is put in the Region Code to search
on.

This report works fine, but when no Region Code is set, multiple records are
returned by the join of the ContractRegions to the Contracts table, and all
the data in my report is duplicated.

So, my question, sorry if my example isn't very clear: can I remove the join
at runtime if no Region Code is specified, or is there a better way to
design the report?

Thanks in advance, even if you only had the patience to read all this!

Ryan

One of the tables

Comments

  • edited March 2003
    Ryan,

    Instead of using joined datasets and a grouped style report, try creating a
    Master-Detail report using subreports. Link the datasets using standard
    Delphi linking. Creating a Master-Detail report is more flexable than a
    grouped based report because you can set the subreport visibility, set
    SkipWhenNoRecords on the detail datapipeline, and also set the
    NoDataBehaviors on the subreports. Check out the help file on TppSubreport
    and also please see demos 61 - 80 in the main reports demos project for more
    information.

    --
    Best Regards,

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