Icon View Incident Report

Serious Serious
Reported By: Paul Coshott
Reported On: 2/9/2022
For: Version 3.01 Build 4
# 4874 TDataSet Find Method Setting Invalid Row Index When FindNearest Parameter Enabled

The procedure below has a problem on the dsPlayerList.Find line. When the final character of the column value is typed, an error occurs.

Row index -241 out of bounds

For example, if I have two members with first names of Rob and Rod.

I type r and it jumps to the first R name. Then I type o and it matches "Rob". If I then type d, the cursor doesn't move, it remains on Rob and the above error occurs.

I added a try except around the Find, and this stopped the error, but I can't find Rod, it only goes to Rob.

procedure TfGuestSearch.DoGuestSearch(sGuest : string);
var
  sColName, sColValue : string;
begin
  //find the guest using which ever column has been selected for sorting
  if bReSort then begin
    bReSort := False;
    dsPlayerList.Open;
    if gcFirstName.SortDirection = sdAscending then begin
      dsPlayerList.Columns['FIRST_NAME'].SortDirection := sdAscending;
    end else if gcFirstName.SortDirection = sdDescending then begin
      dsPlayerList.Columns['FIRST_NAME'].SortDirection := sdDescending;
    end else if gcSurname.SortDirection = sdAscending then begin
      dsPlayerList.Columns['SURNAME'].SortDirection := sdAscending;
    end else if gcSurname.SortDirection = sdDescending then begin
      dsPlayerList.Columns['SURNAME'].SortDirection := sdDescending;
    end;
    dsPlayerList.SortCaseInsensitive := True;
    dsPlayerList.Sort;
  end;

  if (gcFirstName.SortDirection = sdAscending) or (gcFirstName.SortDirection = sdDescending) then begin
    sColName := 'FIRST_NAME';
    sColValue := sGuest;
  end else if (gcSurname.SortDirection = sdAscending) or (gcSurname.SortDirection = sdDescending) then begin
    sColName := 'SURNAME';
    sColValue := sGuest;
  end;
  //now do the actual search
  dsPlayerList.Find([sColName], [sColValue], True, True);
end;



Comments Comments
This was due to a bug in the TDataSet Find method when NearestMatch parameter was set to True.


Resolution Resolution
Fixed Problem on 2/12/2022 in version 3.02 build 1


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial

Image