Home DADE

How to use parameter to link one pipeline to another pipeline

edited November 2013 in DADE
Delphi XE & RB 14.08 Enterprise + Server edition.

I need some help using parameters to link a datapipeline to another one
not exposed in the Data tab. I have never used parameters in RB DADE
before, so I probably just don't know how to set this up.

I have some datapipelines defined in Delphi code, and I want the end
user to be able to use the Data tab to create a new data view and link
to the record of one of those pipelines that show up only in the Design
tab. The link will be based upon the common field named CustNo. There
will be no iteration through the data because this is simply a form
printing for a specific record chosen by the end user.

I create a parameter in the design tab named CustNo. I select the
parameter in the Report Tree and then set the Lookup Settings and User
Interface settings to try to set the value of the parameter to the
value of CustNo field in my desired pipeline. In the Data tab, after
selecting the table and fields, now on the Search tab of the Query
Designer, I attempt to create a criteria of CustNo = Parameter CustNo.
I expect the SQL to be added as Where (Orders.CustNo = :CustNo) but
instead, when I view the SQL, I see Where (Orders.CustNo = 0).

If I check the AutoSearch box, then when the report runs it gives me an
option to select from a list box the CustNo, and the report runs as
expected. However, I don't want the end user to have to choose from a
drop down box. I just want the datapipeline to be linked. When I
uncheck AutoSearch, the SQL shows no Where clause, and the report does
not run as I would like.

Is it possible to use parameters without switching to manual SQL?

In other words, is there a way to get the SQL to add (Orders.CustNo =
:CustNo)?

Is there another way to get the tables linked instead of using Data Tab
(using parameter in RAP perhaps)?

--

Comments

  • edited November 2013
    David,

    Here are the steps:

    1. From the Design workspace, define a Report.Parameters[ ] item, let's
    call it paCustNo

    2. From the Query Designer, define a DADE query with a search condition on
    the paramter paCustNo

    3. I think you've done those steps. The final step is to assign the
    parameter value. You can do this via Delphi or RAP code. Either do this
    prior to calling Report.Print, or use the Report.OnInitializeParameters
    event

    example:

    myReport.Parameters['paCustNo'] := myCustomerPipeline['CustNo'];


    When the report generates, the parameter value will be used in the SQL
    search condition.



    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
    --

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2013
    Nard Moseley (Digital Metaphors) wrote:

    That worked. Thank you!

    This solves my immediate problem, but I wonder if there is an article
    somewhere that explains parameters a little? I still am unsure of some
    of the properties of the parameter and why they are there. I looked in
    the wiki, but did not find much information there.

    --
  • edited November 2013

    1. Here is a link to an rbWiki with Report Parameters Fundamentals

    http://www.digital-metaphors.com/rbWiki/End-User/Fundamentals/Report_Parameter_Fundamentals

    2. I also recommend the RBuilder help reference topics for TppParameter,
    TppAutoSearchSettings, TppLookupSettings, TppParameterList



    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    --

    Best regards,

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