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

Loading Template with TppDPTeeChart dynamically

edited November 2004 in General
Hello,

I have a Template with a TppDPTeeChart. This Template is loaded
on Runimte from a Database. After Loading the template,
the DataPipeline is set to the also dynamically created DataPipeline.
After opening the report, there is no data aware content in the Tee Chart
componemt.
When I save the Template to Disk after loading from DB and setting
the pipeline, the Property DataSource = ppDBPipelineXY is
missing, although it is stored in the Database.

Where is my problem? Do I have to set it explicit after loading?

Tanks
Michael S?lzer

Comments

  • edited November 2004
    Hi Michael,

    When are you loading this template? I believe that if you are creating the
    pipeline dynamically, the template has no way of knowing how to find it and
    link to it. Perhaps in the Template.OnLoadEnd event you could manually
    connect the TeeChart to the dbpipeline to ensure it finds the reference.

    --
    Regards,

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

    Best Regards,

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

    herer is a part of the code for easier explanation:

    procedure TRepGen.Execute(...);
    ...
    // Load Report-Template via Stream
    StreamRTM := TStringStream.Create(AREC_TMPL);
    try
    AReport.Template.LoadFromStream(StreamRTM);
    finally
    StreamRTM.Free;
    end;

    // Connect Pipeline with Report and open
    AReport.DataPipeline := FRBPipeline;
    // SetPipeLine(Areport.Template.Root); ** Added for testing
    FDataSet.Open;

    // Open Report
    AReport.DeviceType := 'Screen';
    AReport.PrintToDevices;
    ...
    end;

    For testing I wrote a recursive procedure that sets the DBPipeline for the
    TeeChart

    procedure TRepGen.SetPipeLine(AComponent: TComponent);
    var
    tee : TChartSeries;
    i : integer;
    begin

    if AComponent is TChartSeries then begin
    tee := (AComponent as TChartSeries);
    tee.DataSource := FRBPipeline;
    end
    else
    for i := 0 to AComponent.ComponentCount - 1 do begin
    SetPipeLine(AComponent.Components[i]);
    end;
    end;

    And I call the function after loading the template

    SetPipeLine(Areport.Template.Root);

    But then I get an AV on PrintToDevices. Perhaps I'm thinking to complicated.
    Or, is it still not possible to set the DataSource property with the
    TeeChart Version
    that shipps with Delphi7? By the way, I use Rb 7.0 and TeeChart 4.04.

    When I save the template to file after calling the SetPipeLine the
    DataSource
    contains the following

    object Series1: THorizBarSeries
    Marks.ArrowLength = 20
    Marks.Visible = False
    DataSource = ppDBPipeline1.Owner
    SeriesColor = clRed
    ShowInLegend = False
    XLabelsSource = 'LABEL1'
    XValues.DateTime = False
    XValues.Name = 'VALUE1'
    XValues.Multiplier = 1.000000000000000000
    XValues.Order = loNone
    XValues.ValueSource = 'DIFF'
    YValues.DateTime = False
    YValues.Name = 'Y'
    YValues.Multiplier = 1.000000000000000000
    YValues.Order = loAscending
    end

    I don't understand, why the DataSource is set to ppDBPipeline1.Owner and why
    it isn't
    set by AReport.DataPipeline := FRBPipeline.

    Thanks for your help
    Michael


This discussion has been closed.