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

Is that possible at the new version

edited February 2005 in End User
Is it possible any how at run-time, for the final user to made a report
based on a SQL, and then put parameters at this SQL ,
and Report Builder understand that parameters as search criterias prompting
a value for them ???

Like that :

I have a sql like this

SELECT * FROM TABLE WHERE FIELD1 = :parameter1


When i choose to open the report, is asked a value for the 'parameter1'
?

All this at run time, no Delphi modifications need.




Is that possible?

Comments

  • edited February 2005

    No. But you can something like this.....


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

    lSQLBuilder.Clear;
    lSQLBuilder.SelectTables.Add('Customer');
    lSQLBuilder.SelectFields.AddAllFields;
    lSQLBuilder.SearchCriteria.AddAutoSearch('Customer', 'Company', 'Like',
    'S');


    lSQLBuilder.Free;


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2005

    Check out the online help topic for TdaSQLBuilder. From there you can
    navigate to related topics that contain sample code.

    Here is an example taken from the online help. It shows how to add the
    customer table and add the orders table with a join to customer.

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

    lSQLBuilder.Clear;
    lSQLBuilder.SelectTables.Add('Customer');
    lSQLBuilder.SelectTables.AddJoin('Orders', 'Customer', 'CustNo', '=',
    'CustNo'); lSQLBuilder.SelectFields.AddAllFields;


    lSQLBuilder.Free;

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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2005
    What if i have two related tables in my sql.

    Should i add all tables using lSQLBuilder.SelectTables.Add and then specify
    the table name when adding AutoSearch criterias ??


  • edited February 2005
    didn?t work.

    I have a simple sql at the report - 'SELECT * FROM CUSTOMER';

    then i add the code you said.


    But, showing the SQL Text after the code you said, the SQL Text didn?t
    change, still: 'SELECT * FROM CUSTOMER';


  • edited February 2005

    It will not work if you have manually edited the SQL text. And the timing of
    when it happens is important also.


    I just tried a simple example using DBDemos and it worked in my test. Here
    is what I did....

    1. Use QueryWizard to create a query on the custom table.

    2. Implement Report.OnInitializeParameters event in RAP code:

    var
    lSQLBuilder: TdaSQLBuilder;
    begin
    lSQLBuilder := TdaSQLBuilder.Create(Report.DataPipeline);
    lSQLBuilder.Clear;
    lSQLBuilder.SelectTables.Add('Customer');
    lSQLBuilder.SelectFields.AddAllFields;
    lSQLBuilder.SearchCriteria.AddAutoSearch('Customer', 'Company', 'Like',
    'S');
    lSQLBuilder.Free;





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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2005
    Will this functionality be included in a future release?
  • edited February 2005

    It may possibly be included in a future release.

    Right now, any time you manually type in SQL text you lose the ability to
    link queries or have autosearch parameters. It would be nice if you could do
    that. But its a huge change from the way in which the QueryDataView was
    designed and implemented.

    RB 9 adds new Report level events and the new SQLBuilder class. This enables
    you to programmatically define the SQL using simple methods to add tables,
    fields, search conditions etc. And it supports RAP code. Internally this
    manipulates the TdaSQL object which is responsible for generating the SQL
    text.


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2005
    Is there anyway, anytime i can modify the SQL ? which event should i
    use?


  • edited February 2005
    like load to the sql a text from a file?



  • edited February 2005

    Report.InitializeParameters and BeforeOpenDataPipelines were both designed
    to fire prior to the report generating. The InitializeParameters event
    occurs prior to any autosearch activity. You can create custom parameters,
    display a custom dialog, etc. It also enables you to cancel the report. The
    BeforeOpenDataPipeline occurs later, but just before the report engine opens
    all of the datapipelines.

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



    Best regards,

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