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

Dataviews

edited January 2003 in General
We have some reports that use custom dataviews for report writer
versions 5.56 and 5.52. I do not want to use them anymore and
wondered if there was some way to switch the dataviews at run-time
(for customers custom reports for example) and convert them to use new
datamodules that I write using dbpipeline fields.

Comments

  • edited January 2003
    Let me get this traight, you want to take the dataviews that your customer
    has created, and convert them to be delphi data access components on your
    datamodule?

    Do you have something coded to handle autosearch criteria that your users
    may have created in the dataviews? The rest of it is pretty easy, except
    order by's maybe. If you have indexes and are using table components it may
    not be a problem.

    Master detail links may be a problem too, as you will have to parameterize a
    query, or tell the dataviews to generate the magic SQL and the copy the
    magic SQL to queries on yoru datamodule.

    You'll have to loop through the dataview in the report and extract their SQL
    objects. I'm sure you've seen this posted before, but this example
    (updated yesterday) show how to do this:
    http://www.digital-metaphors.com/tips/ExtractSQLObject.zip

    Check the SQL object's EditSQLAsText property as the first step, as you can
    simple copy the SQLText to a query on a form. If it is false, then you'll
    have to loop through the select fields, order by fields, calc fields, group
    fields, and serach criteria fields to build queries. If there is MD linking,
    then I think you'll want to load the user's template, open the pipelines
    which the report is using (which will cause the dataviews to generate the
    magic SQL) and then read the magic SQL from the SQL objects and copy it into
    your queries. Then you'll have to create the master field links on the
    pipelines as well. See the article below.


    Cheers,

    Jim Bennett
    Digital Metaphors

    ---------------------------------------------------------
    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

This discussion has been closed.