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

Report loading with a blank page ...

edited April 2007 in General
Hi,

I have created a report in the report designer and saved it as a
reporttemplate.rtm filename.

Now i want to load the report at runtime without loading it into the report
designer.

What other code do i have to use to get the report to execute correctly, i
have a feeling the datapipelines have to be created but i have no idea how
to do it in code.

Below is a code snipet that im using to execute the report currently. You
help would be greatly appreciated.

with rbReportTemplate do
begin
ADOQuery1.Open;
Template.FileName := 'reporttemplate.rtm';
DeviceType := 'Screen';
PreviewFormSettings.WindowState := wsMaximized;
Print;
end;


Regards,




Trevor

Comments

  • edited April 2007
    Hi Trevor,

    Where are you loading the template file? Note also that the pipeline will
    need to be connected to the report after the template is loaded, perhaps
    using the Template.OnLoadEnd event. See the Using Template Events thread in
    the Tech-Tips newsgroup for more information.



    with rbReportTemplate do
    begin
    ADOQuery1.Open;
    Template.FileName := 'reporttemplate.rtm';
    Template.LoadFromFile; //Need to load the report here.
    DeviceType := 'Screen';
    PreviewFormSettings.WindowState := wsMaximized;
    Print;
    end;


    --
    Regards,

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

    Best Regards,

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

    Thank you for replying.

    Yes thank you that did fix it.

    Just one concern now.

    With the datapipeline i have actual linked it via the ppDBPipeline component
    and have also linked in a TwwDatasource and ADO Query.

    But the problem im having if i use the record that i designed the report
    template with it comes up, if i select a different record i get a blank
    page.

    Is it the internal datapipeline that i used, if so do i clear it and how do
    i clear it.

    Or do i drop the ppDatapipeline, TwwDatasource and ADO Query and use the
    internal datapipline. This is what i have after i load the report in the
    report designer in the datapipeline property box ... DataPipeLine =
    daADOQueryDataView1->ChildDBPipeline1

    Please show me how to do it in the code below. Thank you in advance.

    with rbReportTemplate do
    begin
    Template.FileName :=
    SystemDM.tabSaleType.FieldValues['Template'];
    Template.LoadFromFile;
    DeviceType := 'Screen';
    PreviewFormSettings.WindowState := wsMaximized;
    Print;
    end;

    Regards,




    Trevor

  • edited May 2007
    Hi Trevor,

    It looks as though you are already defining your data in the data workspace
    (DADE) so there is no need to create a Query, DataSource, Datapipeline group
    on your form. My recommendation would be to keep all you data access local
    to the template you are loading.


    I'm unclear what is happening here. Please give me a bit more information
    about what you are trying to accomplish.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    Hi Nico,

    Im really having problems trying to pass the datapipeline to the ppreport if
    it is defined when i load the report within the template it works fine. But
    i need to load this report on the fly. this is what im getting in the
    datapipline = daADOQueryDataView1->ChildDBPipeline1 how do i pass this in
    code.

    This is what i have right now.

    with rbReportTemplate do
    begin
    Template.FileName :=
    SystemDM.tabSaleType.FieldValues['Template'];
    Template.LoadFromFile;
    DeviceType := 'Screen';
    PreviewFormSettings.WindowState := wsMaximized;
    PreviewFormSettings.ZoomSetting := zsPageWidth;
    Print;
    end;

    Thanks in advance.

    Regards,


    Trevor

  • edited May 2007
    Hi Trevor,

    I'm a bit unclear about how your report is designed.

    1. If there is a datapipeline on a form that you wish to connect to a
    report that is loading templates, you can connect that pipeline to the
    report using one of the template events such as OnLoadEnd. For instance...
    Report.DataPipeline := ppDBPipeline1;

    See the Using Template Events message in the Templates thread of the
    Tech-Tips newsgroup for more information on template events.

    2. If you are defining your datasets in the data workspace (data tab of the
    designer), you can access the pipelines created using the
    TdaQueryDataView.DataPipelines property. For instance...

    ppReport1.DataPipeline := daBDEQueryDataView1.DataPipelines[0];

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.