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

Accessing SQL property

edited March 2003 in End User
I can access Fields in a RAP DataSet by simply dragging and dropping from
the Data tab of the Code Toolbox. However, is it possible to access the SQL
property of a RAP DataSet?
Thanks,

Warren

Comments

  • edited March 2003
    I realize my previous post may have been rather vague, so let me be more
    specific. Instead of using the Design wizard to create the dataset and
    automatically generating the SQL in my report I wrote the SQL statement
    seperately and pasted it into the SQL page of the DataSet. Here is the SQL
    statement:

    select C.bclient,C.clientid,C.ClientNum,C.Phn1,C.Phn1Ext,C.Phn1Contact,
    (select sum(AMOUNT) from billing where clientid=C.ClientID and
    trantype='INV' and
    trandate between '2003-01-01' and '2003-03-01')as PreAmt,
    (select sum(amount) from billing where clientid=C.Clientid and
    trantype='INV' and
    trandate between '2003-03-01' and '2003-03-13') as LastAmt
    From Client C
    where PreAmt > 300 and LastAmt<100

    What I need to do, is change the dates ('2003-01-01') and the compare values
    (300,100) based on User Input. I wrote RAP Functions to prompt the user for
    the data and that works fine. What I need now is to know how to get the User
    input into the above SQL statement, thus returning the data based on the
    user's choices. AutoSearchDialog fields may work for the dates, but they
    will not work for the compare values, that is why I am manually entereing
    the SQL instead of using a Wizard.
    Thanks,

    Warren


  • edited March 2003
    TdaSQL is not surfaced in RAP.

    Autosearch is the preferred way to use and set DADE autosearch criteria.
    There is an example in the Autosearch demos which set the end user search
    criteria in DADE at runtime.

    If you simply have (non-auto) search criteria and are showing a custom input
    dialog, then you'll have to edit the criteria values manually as you
    described that you want to do. This can be done, though the first approach
    should not be editing the SQL text, but rather by using the members of the
    TdaSQL interface. This way you don't lose the query tools support on the
    dataviews once you edit the SQL text. Here is an example which extracts the
    TdaSQL object for a report and then uses it to set the criteria as well as
    other options of the SQL object, such as OrderBy. Get an example working
    using Delphi code first which sets the criteria values using the demo as a
    starting point, then port it over to use RAP. In RAP, you'll have to code a
    RAP pass through function in Delphi code to access and set properties and
    call methods on the TdaSQL object. There are examples of creating pass
    through functions in the RAP tutorials and demos. It is also explained in
    the RAP help file and the Developer's Guide pdf.

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


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.