Jump to content

Recommended Posts



    if (SearchText[1]='*') then //  SearchText comes from a variable with UPPERCASE
      Delete(SearchText,1,1);  // Deleting * 
      FilterText:='UPPER(ITEMNAME) CONTAINING '+QuotedStr(SearchText);
    end else
    FilterText:='UPPER(ITEMNAME) STARTS '+QuotedStr(SearchText);

I'm getting Filter Expression Incorrectly Terminated.
What is wrong ?

Thank You

Share this post

Link to post
Posted (edited)

Are you sure CONTAINING and STARTS are valid filter keywords?


I'd try UPPER(ITEMNAME) LIKE ''' + SearchText + '''' instead. 

Edited by aehimself

Share this post

Link to post

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

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
Posted (edited)


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 by Serge_G

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now