Filter option gives false results
Posted: 08.02.2012, 22:14
When there are columns in the source table that only contain numbers (in VARCHAR columns) that are included in the filter, the results seem to be totally random and non-relevant.
For example, the code below works flawless:
But when the commented out line is active, it does not work at all.
In this image the problem is clearly visible:
Here is a download link to the Delphi 2010 test project including the database:
http://dl.dropbox.com/u/32493275/ZEOSTEST/ZEOSTEST.zip
For example, the code below works flawless:
Code: Select all
procedure TForm1.SearchEditChange(Sender: TObject);
var
filterQuery : String;
begin
if Length(SearchEdit.Text) >= 3 then
begin
TestTable.FilterOptions:= [foCaseInsensitive];
filterQuery := 'Name LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
' OR Street LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
//' OR Nr LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
' OR Town LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
' OR Phone LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
'';
TestTable.Filter := filterQuery;
TestTable.Filtered := true;
end
else
begin
TestTable.Filtered:= False;
end
end;
In this image the problem is clearly visible:
Here is a download link to the Delphi 2010 test project including the database:
http://dl.dropbox.com/u/32493275/ZEOSTEST/ZEOSTEST.zip