Page 1 of 1

Filter on a query

Posted: Thu 18 Sep 2008 20:30
by ccmcbride
I've been messing with the crDBGrid.
I am working on the logic to apply a filter, when the data source is a query.
I don't want to add to the filtersql of the query, because the query is long and complex, but adding the filter 'Name like %Mark% is returning 0 rows, even though there are several 'marks'....
Is it possible to use extended filters like this on a table/query?
If so, how?
If not, How can I implement it?

Posted: Fri 19 Sep 2008 11:50
by Dimon
To specify the text of the filter for a dataset you should use the following code:

Code: Select all

MyQuery.Filter := 'FieldName like ''%mark%''';

Posted: Fri 19 Sep 2008 16:57
by ccmcbride
NM, my bad.
Forgot to turn on case insensitive, and turn off nopartial compare on the filters...