Filter on a query

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ccmcbride
Posts: 101
Joined: Tue 01 May 2007 16:36

Filter on a query

Post by ccmcbride » Thu 18 Sep 2008 20:30

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?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 19 Sep 2008 11:50

To specify the text of the filter for a dataset you should use the following code:

Code: Select all

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

ccmcbride
Posts: 101
Joined: Tue 01 May 2007 16:36

Post by ccmcbride » Fri 19 Sep 2008 16:57

NM, my bad.
Forgot to turn on case insensitive, and turn off nopartial compare on the filters...

Post Reply