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

How to add a field for JIT with code ?

edited January 2004 in General
procedure TFrmGz.Button1Click(Sender: TObject);
var
x:TppField;
begin
x:=TppField.Create(nil); // or x:=TppField.Create(self) or x:=
TppField.Create(ppJITPipeline1) , the results are same!
with x do
begin
FieldName:='aa';
FieldAlias:='aa';
end;
ppJITPipeline1.AddField(x);
ppDesigner1.ShowModal;
end;
--------------------------------------------------------------

I can view the field when ppDesigner shows.But when I close the main form ,
an error occurs 'invalid pointer'.
What is the proper method ?
Thank you.

Comments

  • edited January 2004
    Here's my code for adding fields at run time to a JIT pipeline:
    procedure TForm1.ConfigurePipelines);
    procedure AddJITField(aPipeline: TppJITPipeline; aDataType: TppDataType;
    aFieldName: String; aSize: integer = 0 );
    var
    lField: TppField;
    begin
    lField := TppField.Create(aPipeline.Owner);
    lField.DataType := aDataType;
    lField.FieldLength := aSize;
    lField.FieldName := aFieldName;
    lField.DataPipeline := aPipeline;
    end;
    begin
    FMasterJIT := TppJITPipeline.Create(self);
    FMasterJIT.Name := 'plHypotheticalReturnValues';
    FMasterJIT.OnGetFieldValue := GetMasterFieldValue;
    FMasterJIT.RecordCount := 1;
    AddJITField(FMasterJIT, dtstring, STR_Title);
    AddJITField(FMasterJIT, dtMemo, STR_Disclaimer);
    AddJITField(FMasterJIT, dtDouble, STR_CurrentValue);
    ...

    HTH
    Ed Dressel
    Team DM
This discussion has been closed.