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

SQL Wizard as stand-alone??

edited April 2004 in General
The SQL wizard is terrific... so much so that I would like my end
users to be able to use it for general data queries. That way they would
have a consistent wizard for reports as well as general queries.

Question:
Is it practical to set up just a SQL wizard so that the generated SQL
could then be saved? The generated data set does not need to have a
report. The saved/generated SQL would then be used elsewhere within the
application.

Is there an example of such an application?


Jon
--
Jon Lloyd Duerdoth
Welsh Dragon Computing
http://www.welshdragoncomputing.ca
Visit All Saints' Kingsway Anglican Church
http://www.allsaintskingsway.ca

Comments

  • edited April 2004
    Hi Jon,

    Below is a link to an example that loads the query wizard and query designer
    as stand alone forms. Hope this helps.

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

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2004
    Nico,

    Exactly what I was looking for... thanks.

    I'm using DBISAM. Could you give me a hint as to what else I need to
    change other than:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    FSession := TdaDBISAMSession.Create(Self);

    {set SQL properties}
    FSQL := TdaSQL.Create(Self);

    FSQL.Session := FSession;
    FSQL.AllowSelfJoin := True;
    FSQL.DatabaseName := 'dbx'; // <- what goes here????

    FSQL.DatabaseType := dtDBISAM;
    FSQL.SQLType := sqSQL2;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    I seem to be missing the place where I would set the path to the data.
    Assigning the name of an existing database component doesn't seem to be
    correct solution

    Jon




  • edited April 2004
    Hi Jon,

    You need to place a TDBISAMDatabase component on your form with the proper
    connection settings. Then you can set the session and SQL object settings
    according to the name of the database. You will also need to define the
    TdaSession.DataOwner as the form or datamodule that the database object is
    on. Something like the following...

    procedure TForm1.FormCreate(Sender: TObject);
    begin

    FSession := TdaDBISAMSession.Create(Self);
    FSession.DataOwner := Self;

    {set SQL properties}
    FSQL := TdaSQL.Create(Self);

    FSQL.Session := FSession;

    FSQL.AllowSelfJoin := True;
    FSQL.DatabaseName := 'dbData';
    FSQL.DatabaseType := dtDBISAM;
    FSQL.SQLType := sqSQL2;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2004
    Nico,

    Actually I had already done all of that !except!
    FSession.DataOwner := Self;
    That fixed it!

    Another question:
    Is it possible to pre-load SQL into the designer?
    That would allow me to store the SQL and retrieve it at some future
    time.

    A small problem with the wizard:
    The icons are missing from the buttons used to transfer
    available tables etc. from one panel to the other.

    Thanks,
    Jon


  • edited April 2004
    Hi Jon,

    1. Unfortunately you cannot simply "pre-load" SQL text into the designer
    (this would be considered edited SQL which the query designer does not
    support).

    2. Add the following line just below the interface call in your project to
    include the dade bitpmaps for the speed buttons in the wizard.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2004
    Nico


  • edited April 2004
    Sorry... I must be tired :)

    You need to add the Dade BMP resource file for the images on the speed
    buttons to show up.

    {$R daIDEBmp.res}

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2004
    Nico,
    With help like you're giving me there is no need
    for apologies... Rbuilder support is terrific as all your
    users will concur!

    Thanks once again,
    Jon

This discussion has been closed.