Henry Olive 5 Posted May 8, 2021 Delphi-XE dm.SDetail.Filtered:=False; if (SearchText[1]='*') then // SearchText comes from a variable with UPPERCASE begin Delete(SearchText,1,1); // Deleting * FilterText:='UPPER(ITEMNAME) CONTAINING '+QuotedStr(SearchText); end else FilterText:='UPPER(ITEMNAME) STARTS '+QuotedStr(SearchText); dm.SDetail.Filter:=FilterText; dm.SDetail.Filtered:=True; I'm getting Filter Expression Incorrectly Terminated. What is wrong ? Thank You Share this post Link to post
aehimself 396 Posted May 8, 2021 (edited) Are you sure CONTAINING and STARTS are valid filter keywords? I'd try UPPER(ITEMNAME) LIKE ''' + SearchText + '''' instead. Edited May 8, 2021 by aehimself Share this post Link to post
Henry Olive 5 Posted May 9, 2021 Thank you so much aehimself, You are right we cant use SQL commands STARTS-CONTAINING in Filter Expressions. I used LIKE and SearchText+% LIKE and %+SearchText+% Thank you again. Share this post Link to post
aehimself 396 Posted May 9, 2021 A long time ago I found this document, which shows the power of the .Filter property of DataSets. However it is Zeos-referenced I doubt that majority (or all) will not work on a regular dataset component. Feel free to take a look: ZeosLib - Browse /documentation at SourceForge.net and download zExpression.pdf. Share this post Link to post
Serge_G 87 Posted May 11, 2021 (edited) Hi, For me, filter expressions complies only with the old LocalSQL of BDE so no STARTS nor CONTAINING. Usually, I don't use tables, only querys to avoid this problem, and some Query data components have the good idea to offer macros to manage this sort of case Edited May 11, 2021 by Serge_G Share this post Link to post