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

Dynamic TppFields

edited December 2004 in Subreports
Hello,

I create TppFields dynamicly :

procedure CreateJitFields ;
var
NewField : TppField ;
begin
for k:=1 to myGrid.Columns do begin
NewField := TppField.Create(self) ;
NewField.Fieldname := myGrid.ColumnTitle[k] ;
myJITPipeline.AddField(NewField) ;
end;
end;

This works fine, but I get an AccessViolation when closing my App.
I tried several Owners (nil, self, myJITPipeline)...

What do I do wrong,

kind regards,

Dirk Janssens.

Comments

  • edited December 2004

    1. There is a DataPipeline.DefineFields method that you can call to create
    fields dynamically.

    function DataPipeline.DefineField(aFieldName: String; aDataType:
    TppDataType; aFieldLength: Integer): Integer;

    example:

    ppJITPipeline1.DefineField('Company', dtString, 30);


    2. To make your existing example code work properly. Replace

    myDataPipeline.AddField(myField);

    with

    myField.DataPipeline := myDataPipeline;




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



    Best regards,

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