RecNo bug (SetRecNo)

There seems to be a bug in the current version of Aurelius where setting the RecNo doesn't not advance it.  I'm binding my dataset to a TObjectList<>

I've bolded and underlined the offending lines of code.  If the record you are trying to set it to Value (2 in my case) is greater than the FFilterView.FilteredCount (always 0) then the Value is set to 0

At the end of this code is the implementation of SetRecNo I was previously using.

Aurelius Latest

procedure TBaseAureliusDataset.SetRecNo(Value: integer);
begin
  CheckBrowseMode;
  if Value < 1 then
    Value := 1;

  if Filtered then
  begin
    if Value > ListCount then
    begin
      while FetchingRecords and (Value > ListCount) do
        FetchMoreRecords(FSourceList);
      if Value > ListCount then
        Value := ListCount;
    end;
  end
  else
  begin
    if Value > FFilterView.FilteredCount then
    begin
      while FetchingRecords and (Value > FFilterView.FilteredCount) do
        FetchMoreRecords(FSourceList);

//The following two lines are the issue
      if Value > FFilterView.FilteredCount then
        Value := FFilterView.FilteredCount;
    end;
  end;

  if RecNo <> Value then
  begin
    DoBeforeScroll;
    if Filtered then
      FCurrent := FFilterView.GetOriginalIndex(Value - 1)
    else
      FCurrent := Value - 1;
    Resync([rmCenter]);
    DoAfterScroll;
  end;
end;

Aurelius Previous

procedure TBaseAureliusDataset.SetRecNo(Value: integer);
begin
  CheckBrowseMode;
  if Value < 1 then
    Value := 1;
  if Value > ListCount then
  begin
    while FetchingRecords and (Value > ListCount) do
      FetchMoreRecords(FSourceList);
    if Value > ListCount then
      Value := ListCount;
  end;

I just noticed that the line at the beginning should be:


  if not Filtered then

That seems to fix it.

Hello Mark,


Thank you for the feedback. This was something already detected here internally and the next version will include the fix and more improvements in this area. The update should be released in a couple of days.