Home Datapipelines

Report in run time

edited September 2002 in Datapipelines
Hi,

I want to create a report in run time and load the layout from a .rtm file.
How can I link the reports's fields to JITPipeline's field?

Thanks
Marina

=====
var
JITPipeline: TppJITPipeline;
Report: TppReport;

begin
JITPipeline := TppJITPipeline.Create(Self);
Report := TppReport.Create(Self);

with JITPipeline do
begin
InitialIndex := 0;
DefineField('name', dtString, 25);
OnGetFieldValue := GetFieldValue; // function already defined
RecordCount := 10;
end;

with Report do
begin
DataPipeline := JITPipeline;
DeviceType := dtScreen;

Template.FileName := 'c:\temp\file03.rtm'; // There is a TppDBText
object named ppTexto
Template.LoadFromFile;

// I tried to link the fields here, but a Stack overflow error
occurred...
TppDBText(Report.Template.Root.FindComponent('ppTexto')).DataPipeline :=
JITPipeline;
TppDBText(Report.Template.Root.FindComponent('ppTexto')).DataField :=
'name';
end;

Report.Print;
end;

Comments

  • edited September 2002
    The data aware controls use the ParentDataPipeline property to determine
    where to connect to the data. If the data pipeline that the template was
    saved with matches the one that exists where the template is loaded, then it
    will use that pipeline to try and find the field name. If the field name
    matches, then the data aware control should automatically hook itself up to
    the pipeline and datafield. If the datapipeline name and field name don't
    match, then the data aware control can't resolve the place where it should
    get its data. You'll have to manually reconnect it at that point. The
    solution is to save the template down with the data aware controls
    configured for the datapipeline name and field names that will be used when
    the report is loaded at runtime.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.