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

load a dtm at run time

edited February 2002 in General
Hi

I use the Query Designer of RepportBuilder to load and store '.dtm' files.
Is it possible to load a dtm file at run time just before printing a report
(with the TppReport) ?

Thank you

Simonnx@hotmail.com

Comments

  • edited February 2002
    You can free the previous datamodule, and load a new one via the
    datamodule's template object.

    procedure...
    var
    lDataModule: TdaDataModule;
    begin

    lDataModule := daGetDataModule(ppReport1);
    lDataModule.Free;

    lDataModule := TdaDatamodule.Create(Self);
    lDataModule.Template.FileName := 'C:\DataModules\Customer.dtm';
    lDataModule.Template.LoadFromFile;
    lDataModule.Report := ppReport1;
    ...


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2013
    Hello

    I use the TdaQueryDesigner sample in order to save the SQL result in my
    DataBase, this is to make the user construct his own queries.


    -----------------------------------
    if FMemoryStream.Size > 0 then LoadSQLFromStream(FSQL, FMemoryStream);

    lDialog := TdaQueryDesignerForm.Create(Application);
    lDialog.OnValidateName := DataViewValidateNameEvent;
    lDialog.SQLClass := TdaSQL;
    lDialog.SQL.Assign(FSQL);

    lDialog.Initialize;

    If NombreConsulta.Text <> EmptyStr then lDialog.Caption :=
    NombreConsulta.Text;


    if (lDialog.ShowModal = mrOK) then
    begin
    FSQL.Assign(lDialog.SQL);
    SaveSQLToStream(FSQL, FMemoryStream);
    ......
    ....
    ...
    end;

    lDialog.Free;
    ---------------------------------

    How can I reuse the SQL result saved in some table of my DB as a DTM file so
    my users can use the queries designed previously in his own report builder
    templates????


    Thanks






  • edited January 2013
    Hello,

    For future reference, please use your real name when posting to these
    newsgroups.

    The .dtm file is a complete template representation of the entire DADE
    data module (or entire data workspace in ReportBuilder) not just single
    queries like you are creating. RB currently does not have the built-in
    capability to save and load individual dataviews (queries).

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2013
    Thanks Nico

    I know RB doesn't have the built-in capability, that's why I'm asking you
    how to make this possible?

    Supose I create on runtime an empty datamodule, if I can create just one
    view into it and load the SQL constructed before this can make the trick.


    Thanks so much.



  • edited January 2013

    Here is an rbWiki example that shows how to create DataViews via code.

    http://www.digital-metaphors.com/rbWiki/DADE/Program_Control/How_To...Create_Query_DataViews_via_Code


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

    Best regards,

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