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

Load SQL statement from RAP

edited December 2004 in RAP
In RB 9 is there a way to load a SQL statement from a file using RAP?

I realize that I can now use the SQLBuilder but it is very arcane and
laborious. It would be much easier if there was a way to assign the SQL
statement as a text string and read the text string from a file.

--
Bill Todd

Comments

  • edited December 2004

    TdaSQLBuilder provides a run-time interface to the TdaSQL object that is
    associated with a QueryDataView. The TdaSQLBuilder.SQL property contains the
    reference to the TdaSQL object. The TdaSQL.SQLText property is a TStrings
    object. Therefore you could modify the SQL text directly via the following:

    TdaSQLBuilder.SQL.SQLText.Text


    However, be aware that once you manually modify the SQLText, the automated
    AutoSearch and Linking features can no longer be used. See the following
    article...

    ----------------------------------------------
    Tech Tip: Limitations of using TdaSQL.SQLText
    ----------------------------------------------

    The TdaSQL object can contain either an object based description of the SQL
    (SelectTables[], SelectFields[], etc.) that it uses to generate SQLText OR
    it contain a SQLText string. If you specify the SQLText string then TdaSQL
    will not generate any SQLText. Therefore the built-in AutoSearch and Linking
    features can no longer be used - because these require that special SQLText
    be generated.


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2004
    I am missing something. On compile the following code generates "Line
    8: Parser error".

    var
    SqlBldr: TdaSqlBuilder;
    begin
    aCancel := False;
    SqlBldr := TdaSQLBuilder.Create(Report.DataPipeline);
    SqlBldr.Clear;
    SqlBldr.Sql.SqlText.Text := 'SELECT * FROM CUSTOMER WHERE STATE =
    'HI';
    SqlBldr.Free;
    end;

    --
    Bill Todd

  • edited December 2004
    Ignore that. The parser stumbled on my incorrect quotes.

    --
    Bill Todd
This discussion has been closed.