Author: Tomas Rutkauskas
How to filter on substrings within a string field's value
Answer:
In the TTable OnFilter event:
1 var2 sp, ss: ShortString
3 begin4 with DataSet do5 begin6 sp := FilterPosition.Text; {TEdit containing substring to be filtered}7 ss := AnsiUpperCase(FieldByName('MyField').asString);
8 Accept := Pos(sp, ss) > 0;
9 end;
10 end;
or with an SQL script:
SELECT * FROM MyTable
WHERE UPPER(MyField)LIKE "%UPPER(MySubstring)%";