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.
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.
Comments
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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 ...
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