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

Multiple table reporting

edited November 2001 in General
I have a report generator in my application which originally was intended to
provide the user with columns from a given table which they could choose and
report on. The underlying architecture has now changed such that there are
two tables which are related via master-detail relationships. I need to
traverse the smaller, sorted, table but still report all of the columns in
the much larger detail table. Without DADE, how do I do this in
ReportBuilder? I looked at the JITPipeline component and the examples and
don't see it as helpful. I also understand that the DBPipeline doesn't
recognize the masterpipeline property. Can you provide a quick code example
of showing only the detail table columns for reporting purposes, but
traversing the master ttable to provide the records to display and their
order?

Thanks!
Tom.

Comments

  • edited November 2001
    Here's a demo which sets up the master detail relationship for each detail
    band (master record) before each detail band prints:

    http://www.digital-metaphors.com/tips/ManualMasterDetail.zip

    You could also code a query so that it returns all records for all details
    in the proper order for the master. The detail query should be ordered by
    the key linking field and by all of the master's ORDER BY's first. You can
    create a query in DADE and then Ctrl-click over the detail dataview to see
    the sql that DADE generates behind the scenes for as illustration of this
    approach.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    This is very helpful as a way to create the master/detail relationship
    report in the IDE. Can you give me an exapmple of the same thing where the
    report is created in code? I can't find from the help or examples how to
    create a sub-report component on the fly.

    Thanks!
    Tom.
  • edited November 2001

    1. An example of creating a subreport in code can be found in the Code
    Based section thread of the Tech Tips newsgroup.

    2. Below is a Tech Tip on creating the m/d datapipeline links in code.


    ---------------------------------------------------------
    Tech Tip: Define Master/Detail DataPipeline Links in Code
    ---------------------------------------------------------

    Defining a Master/Detail relationship for a DataPipeline
    requires that the detail pipeline have the
    following properties defined:

    1. MasterDataPipeline

    2. MasterFieldLinks


    At Delphi design-time you can use the object inspector
    and the DataPipeline's FieldLinks editor to define
    the master/detail relationship.


    The following example illustrates how to define the
    master/detail relationship dynamically at run-time.


    var
    lFieldLink: TppMasterFieldLink;


    begin

    {define the master/detail pipeline relationship}
    plDetail.MasterDataPipeline := plMaster;

    {create a new field link }
    lFieldLink := TppMasterFieldLink.Create(nil);

    lFieldLink.Parent := plDetail;

    {assign the detail field name}
    lFieldLink.DetailFieldName := 'CustNo';

    {assign the master field name}
    lFieldLink.MasterFieldName := 'CustNo';


    end;


    Note: The DataPipeline linking requires the records in the detail
    dataset to be ordered by the linking fields. In the above example, the
    detail data must be ordered by CustNo.


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.