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

How to Edit SQL in code prior to running report

edited January 2010 in Datapipelines
How can I edit the SQL of a report prior to generating the report in code?

In the designer of the report, if i manually type in my sql into the data
tab I have no problem editing the sql during runtime using the following
line:
TdaADOQueryDataview(rpt.DataPipeline.DataView).SQL.SQLText.Text := strSQL;

But if i have not right clicked in the ReportDesigner->DataTab->SQL of the
report and clicked on "Edit SQL", the sql appears greyed out in the data tab
and seems to be read only (cannot edit the sql in code). Anytime that i try
the above code to edit the sql it doesnt do anything.

I have searched for hours in the RB pas files trying to find a way. I came
across
TdaADOQueryDataview(rpt.DataPipeline.DataView).EditMode and EditOptions.
I tried setting those before editing the sql, but it still did not work.

I really just need to know what is happening when the "Edit SQL" right click
menu item is clicked so I can programatically set those options at runtime
prior to editing the sql.

Using:
-ReportBuilder Enterprise Edition 10.06
-Delphi 2007

Thanks,
-Adam

Comments

  • edited January 2010
    Hi Adam,

    The TdaSQL.EditSQLAsText property is toggled when you decide to manually
    edit the SQL code in DADE. Setting this to True will give you the same
    effect at runtime.

    You might take a look at the TdaSQLBuilder object for manipulating queries
    at runtime in DADE. Not only does it give you a useful interface for
    manipulating the SQL object, it also gives you direct access to the SQL
    object itself so you don't need to typecast the DataPipeline.DataView
    property. See the TdaSQLBuilder topic in the RB help and the following link
    for examples.

    http://www.digital-metaphors.com/rbWiki/DADE/SQLBuilder

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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