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

Sample of TdaSQLBuilder

edited June 2005 in Datapipelines
I need a Sample of SQLBuilder to change a SQL Statement of pipeline


Thanks

Comments

  • edited June 2005
    Hi Jaime,

    The TdaSQLBuilder topic in the ReportBuilder help file includes numerous
    code examples on how to use the object. Specifically take a look at the
    TdaSQLCriteriaList topic. This gives examples on how to add, remove, or
    insert SQL into the where clause of a query.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2005
    I need to change SQL of various pipelines like this...

    old SQL : Select * from Customer INNER JOIN Banks ON Customers.CodBank =
    Bank.Cod ...

    new SQL : Select * from Customer INNER JOIN Articles ON ...... ( I need
    to delete from clause Banks and other tables .... )

    How can I do it with RB 9.02 ?


    thanks ...



  • edited June 2005

    The TdaSQLBuilder class works in much the same manner as the QueryDesigner.

    I would first try doing this using the QueryDesigner. Write down what steps
    are necessary. For example, when using the Query Designer and you remove the
    Banks table, all of the select fields related to that table will also be
    removed. Using TdaSQLBuilder to remove a table will provide the same result.

    The TdaSQLBuilder has properties such as SelectTables, SelectFields, etc.
    that correspond to the pages of the QueryDesigner.


    I think you need to do the following:


    lSQLBuilder := TdaSQLBuilder.Create(Report.DataPipeline);

    lSQLBuilder.SelectTables.Remove('Banks'); // removes the table, join,
    and related fields
    lSQLBuilder.SelectTables.AddJoin(' Articles', 'Customer', 'CustNo',
    '=', 'CustNo');
    lSQLBuilder.SelectFields.AddAllFields;

    lSQLBuilder.ApplyUpdates;

    lSQLBuilder.Free;



    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

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