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

How can I change SQL right before it's execution?

edited May 2003 in End User
Is there a way to change SQL which is going to be executed right before it's
execution?
(That is - the one that has been manually edited before).

Thanks
MB

Comments

  • edited May 2003
    Ops, sorry - wrong question.
    What I meant to ask was:
    Lets take that the SQL query I'm talking about is manually edited SQL. Then:
    Can I somehow pass modified SQL Query (this time programmatically) for
    execution without modifying the query itself.(So that after I execute
    programmatically changed SQL modifications made to the manually edited SQL
    wouldn't be saved into the reports).

    Hope it wasn't too confusing.^_^


  • edited May 2003
    You'll have to change the SQL that is in the dataview. What you can do is
    save the datamodule in code. Then when the template is saved, you could
    reload the original datamodule. That would be the only way to do it I think.
    Here is an example of replacing the datamodule at runtime.

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

    Editing the SQL text manually is easy, just extract the SQL object as you
    have before, and then set EditSQLAsText to true and set the SQLText
    property. Do this in the Report.Template.OnLoadEnd event.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited May 2003
    Thank you. Much obliged.

This discussion has been closed.