CRDBGrid, FilterBar and customization

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
leonell
Posts: 11
Joined: Sat 24 Sep 2011 07:51

CRDBGrid, FilterBar and customization

Post by leonell » Mon 26 Sep 2011 08:36

Hi,

I have crdbgrid with "string" type columns and FilterBar.

It is filtering exactly what is entered ( column "equals" value).
For example if "John" is entered, then "John" is found, but "John Silver" or "Frank John" are not found.
This is of course correct from some point of view.

Does exist some chance customize it?

Something as:
TCRDBGrid.AfterFilterRequest(col: TCRColumn; var filter: string);
??

Thank you.
Leonell

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 26 Sep 2011 14:44

Hello,

To adjust the filter so that search is performed by the inclusion of symbols into the string rather than by an exact match, you need to use the special character (%).
For example,
%John% will search for all the strings containing John.

leonell
Posts: 11
Joined: Sat 24 Sep 2011 07:51

Post by leonell » Tue 27 Sep 2011 04:27

Hello Alex,
thanks, it is working fine.

Plash from Devart team in 2007 wrotes:
>The TCRDBGrid component doesn't support any expressions in the filter bar. It supports only single values.

Will be nice to change this.

Any my tip is:
add dqeAdvFilterLogic (true/false) property to TCRDBGrid.
When is set then after entering value call AfterAdvancedFiltering() with column and entered value as string. And programmer is responsible to set FilterSQL (or call some CRDB method) correctly.

And where it will help after parsing?

14.2.2012:15.2.2012 ... value between "14.2.2012" and "15.2.2012"
New York|Chicago|Texas ... value in ("New York","Chicago","Texas")
= ... is not null
!New York .. value "New York"
etc

Leonell

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 27 Sep 2011 08:37

Hello,

The TCRDBGrid component is no longer being developed.
Its source code is supplied with SDAC, so you can change it any way you want.

Post Reply