Drag and Drop Access Violation (JIT Pipeline)

edited April 2016 in RAP
Apparently I'm missing some required event handler or property setting
in the creation of our JIT Pipeline. Dragging and dropping a field from
the available listing results in an Access Violation somewhere in
TraCodeManager.EditorDragDropEvent (for which I don't have the source).


FPipeLine.SkipWhenNoRecords := false;
FPipeLine.UserName := 'JITPipeline1';
FPipeLine.OnGetDataSetName := ppJITPipeline1GetDataSetName;
FPipeLine.OnGetFieldValue := ppJITPipeline1GetFieldValue;
FPipeLine.RecordCount := 1;
FPipeLine.RangeEnd := reCount;
FPipeLine.RangeEndCount := 1;

Comments

  • edited April 2016
    And I sent that before I intended to. The other portion is the field
    addition to the pipeline, which I've generalized before..

    for x := 0 to (num - 1) do begin
    Feeld := TppField.Create(FPipeLine);
    Feeld.Name := SectionList[x];
    Feeld.FieldName := 'FieldName' + IntToStr(x);
    Feeld.FieldAlias := 'FieldAlias' + IntToStr(x);
    Feeld.FieldLength := 10;
    Feeld.DisplayWidth := 10;
    Feeld.Position := num;
    Feeld.Alignment := taLeftJustify;
    FPipeLine.AddField(Feeld);
    end


    Are there event handlers or values that are known to be necessary for a
    JIT Pipeline which, if not present, cause an AV when dragging and
    dropping? This is in Delphi XE with RB 17.01 build 65. Thank you.
  • edited April 2016
    Hi Steve,

    Below is a modified version of the code that works in my testing.

    Tips:

    1. To add a Field assign Field.DataPipeline. This will establish the proper
    parent/child relationship. (This pattern is used throughout RB. For example,
    assign Component.Band to add an object to a band, assign Band.Report etc).
    Directly calling DataPipeline.AddField will result in AV's.

    2. Calling JITPipeline.DefineField(aFieldName, aDataType, aFieldLength) is
    an optional way to add fields.

    3. In Delphi the form/datamodule typically 'owns' the Report, DataPipeline,
    and subcomponents. In my code I used TppJITPipeline.Create(Self) and
    TppField.Create(Self).

    4. I don't think assigning the Field.Position is needed.


    var
    liIndex: Integer;
    liField: Integer;
    lsFieldName: string;
    lField: TppField;
    begin

    // create JitPipeline
    FJITPipeline := TppJITPipeline.Create(Self);
    FJITPipeline.UserName := 'JITPipelineTest';
    FJITPipeline.RecordCount := 1;
    FJITPipeline.RangeEnd := reCount;
    FJITPipeline.RangeEndCount := 1;

    // add fields using JITPipline.DefineField(aFieldName, aDataType,
    aFieldLength);
    for liIndex := 0 to 4 do
    begin
    lsFieldName := 'FieldName' + IntToStr(liIndex);
    FJITPipeline.DefineField(lsFieldName, dtString, 10);
    end;


    // add fields by assigning Field.Datapipeline
    for liIndex := 5 to 9 do
    begin
    lsFieldName := 'FieldName' + IntToStr(liIndex);
    lField := TppField.Create(Self);
    lField.Name := lsFieldName;
    lField.FieldName := lsFieldName;
    lField.FieldAlias := 'FieldAlias' + IntToStr(liIndex);
    lField.FieldLength := 10;
    lField.DisplayWidth := 10;
    lField.Alignment := taLeftJustify;
    lField.DataPipeline := FJITPipeline;
    end



    Best regards,

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2016
    Thank you, that was perfect.
This discussion has been closed.