Page 1 of 1

Edit Record gives list index out of bounds

Posted: Wed 20 Apr 2016 00:50
by tudi_x
Hi Support,
I am having an exception when editing a record in a virtual table after adding a field in the virtual table.
Please advise how I can update the virtual table structure and also being able to edit the record.
The code is below. Using Lazarus with Unidac 6.2.10.

Code: Select all

 procedure TVirtualPop.DoRun;
  var
    Source: TVirtualTable;

  begin
    Source := TVirtualTable.Create(nil);
    Source.FieldDefs.Add('ID', ftInteger);
    Source.Open;
    Source.AppendRecord([1]);
    Source.Close;
    Source.FieldDefs.Add('A', ftString);  //works without this line
    Source.Open;
    writeln('NmbFields:' + IntToStr(Source.FieldCount));   //prints 2

    try
      with Source do
      begin
        if Locate('ID', 1, []) then
        begin
          Edit;
          FieldByName('ID').AsInteger := 100;
          Post;
        end;
      end;
    except
      on E: Exception do
      begin
        writeln('Error:' + E.Message);    //prints list index out of bounds
      end;
    end;
    Source.Free;
    Terminate;
  end;        
Thank you,

Re: Edit Record gives list index out of bounds

Posted: Wed 20 Apr 2016 05:35
by AlexP
Hello,

Please specify the versions of Lazarus and FPC

Re: Edit Record gives list index out of bounds

Posted: Wed 20 Apr 2016 13:11
by tudi_x
Lazarus 1.4.4.
FPC 2.6.4.

Re: Edit Record gives list index out of bounds

Posted: Thu 21 Apr 2016 08:54
by AlexP
This issue is already fixed. The new version will be released within a week.

P.S. The new version will include support only for Lazarus 1.6.0 and FPC 3.0

Re: Edit Record gives list index out of bounds

Posted: Mon 25 Apr 2016 16:04
by tudi_x
Hi Support,
I installed version 6.3.11 on Lazarus 1.6 with FPC 3.0.
Confirming the code now works without exception.

Thank you!

Re: Edit Record gives list index out of bounds

Posted: Tue 26 Apr 2016 06:56
by AlexP
Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.