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

Save in a Template - Dade

edited November 2005 in End User
I have a ppReport with ppDBDataPipeline or Dade SQL create in Workspace,
now when I load it workspace set data to none, if none ppDBDataPipeline is
linked it work fine. I tried at runtime to set
ppReport.DataPipeline = nil but it does't work.
How can I do assign at runtime Datapipeline ? How can I known if it was
saved with Dade SQL ?

Thank You

object ppReportEuro: TppReport

AutoStop = False

DataPipeline = daFIBQueryDataView2.VW_CLI2



FBDataREPREPORT.SaveToStream(aRep);
aRep.Position:= 0;

MDIFormDesigner.ppDesigEuro.Report.DataPipeline:= nil;
MDIFormDesigner.ppDesigEuro.Report.Template.Format:= ftBinary;
MDIFormDesigner.ppDesigEuro.Report.Template.LoadFromStream(aRep);

Comments

  • edited November 2005

    1. DADE overview

    When DADE is used, the Report has an associated TdaDataModule that contains
    one or more TdaQueryDataViews. A QueryDataview typically contains the TdaSQL
    object, DBPipeline, and DataSet.

    TppReport
    TdaDataModule
    DataViews[]

    Try the following. Create a new form. Add a report and then use DADE to
    create a query. Close the Report Designer and perform a View Form as Text.
    You can use the objects that are saved as part of the report definition.

    Are you trying to programmatically create some DADE query dataviews?


    2. Report loading

    When a report is loaded, the Report.DataPipeline references are resolved by
    looking in the TdaDataModule for a datapipeline with the same name.

    After you load the report, you can assign any other references that you
    want.





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2005
    I need to change or insert at runtime Datapipeline Name in design mode after
    I load a Report Template.
    I sow your sample in an other your reply message about changing DatabaseName
    after load a Report Template. I am trying to use that code to test if report
    template was saved with a query create in design mode by end-user with Dade
    to avoid exception when it was saved with external data access with
    lSQLBuilder:= TdaSQLBuilder.Create(FReportEuro) and to change Datapipeline
    when it need. How can do it ? Can you adjust or send me a code to test and
    change at runtime DataPipeline ?

    GetSQLObject(FReportEuro, lSQL);

    if lSQL.SQLText.Text <> '' then
    lSQLBuilder:= TdaSQLBuilder.Create(FReportEuro)
    else
    begin
    MDIFormDesigner.ppDBPipeEuro.DataSource:= DSDataSQLRep;
    FReportEuro.DataPipeline:= MDIFormDesigner.ppDBPipeEuro;
    lSQL.DataPipelineName:= MDIFormDesigner.ppDBPipeEuro.UserName;
    SetSQLObject(FReportEuro, lSQL);
    end;


    function GetSQLObject(aReport: TppReport; var aSQL: TdaSQL): Boolean;
    var
    lDataModule: TdaDataModule;
    lDataView: TdaDataView;
    begin
    aSQL := TdaSQL.Create(nil);

    lDataModule := daGetDataModule(aReport);

    if (lDataModule <> nil) then
    begin
    lDataView := lDataModule.DataViews[0];

    if (lDataView <> nil) and (lDataView is TdaQueryDataView) then
    aSQL.Assign(TdaQueryDataView(lDataView).SQL);

    end;

    Result := (aSQL <> nil);
    end;

    procedure SetSQLObject(aReport: TppReport; aSQL: TdaSQL);
    var
    lDataModule: TdaDataModule;
    lDataView: TdaDataView;
    begin
    {get the datamodule}
    lDataModule := daGetDataModule(aReport);

    if (lDataModule <> nil) then
    begin
    lDataView := lDataModule.DataViews[0];

    if (lDataView <> nil) and (lDataView is TdaQueryDataView) then
    TdaQueryDataView(lDataView).SQL := aSQL;

    end;
    end;

    Thank You
    Best Regards

    ***************************************************************************************************
  • edited November 2005
    Sorry for my english

    I wish to be able at runtime to change or insert in list of DataPipelines
    in workspace of my end-user application ppDataPipeline create after load a
    report, because I can have two kind of reports, one with a query linked to
    ppDatapipeline and another custom report, where data was created with Dade
    and saved in template.

    Thank You

  • edited November 2005

    If you are using RB 9.03, then you can check the DataPipeline.SQL property
    to determine whether is is nil.

    if (myreport.DataPipeline <> nil) and (myReport.DataPipeline.SQL <> nil)
    then
    showMessage('Has DADE SQL')





    Best regards,

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

    1) I load a Report from template
    2) I link at runtime myDBPipleline to Report
    2) Show ppDesigner
    3)Now I need to insert in code in Datapipeline List myDBPipleline so in
    Menu Report/Data in WorkSpace can choose it to modify report..

    How can I do is by code ? Can you give me a sample ?

    Thank You





    I wish to be able at runtime to change or insert in list of DataPipelines
    in workspace of my end-user application ppDataPipeline create after load a
    report,

  • edited November 2005
    Sorry

    I had ppDBPipeline.Visible:= False; (I don't known why...) for this I didn't
    see it in Pipeline List of my Report in Design mode

    Thank you


This discussion has been closed.