escape character for underscore (_)

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
fgoutemant
Posts: 6
Joined: Wed 08 Sep 2010 07:01

escape character for underscore (_)

Post by fgoutemant » Thu 29 Mar 2012 08:45

I need to know if it is possible to use a escape character for underscore to use it in ClientDataSet.Filter
Thanks

AndreyZ

Post by AndreyZ » Thu 29 Mar 2012 15:40

Hello,

The TClientDataSet.Filter property doesn't use the '_' symbol for filtering data, it is recognized as a usual symbol. That's why you don't need to use any escape character for the '_' symbol if you want to use in TClientDataSet.Filter . For more information, please read the "Limiting what records appear" article of the Delphi documentation.

fgoutemant
Posts: 6
Joined: Wed 08 Sep 2010 07:01

dataset filter error

Post by fgoutemant » Tue 03 Apr 2012 06:58

Ok. Thanks a lot.
So i have still trouble with the dataset filter.
I have these datas in my dataset :
1_
1_try1
1_try2
when i try to do a filter with the sentence "1_t" I get also the sentence "1_" in my dataset.
Is it normal ?
Thanks for your answer
Best Regards

AndreyZ

Post by AndreyZ » Wed 04 Apr 2012 07:58

Please try using the following code:

Code: Select all

ClientDataSet.Filter := 'fieldname=''1_t*''';
ClientDataSet.Filtered := True;
ClientDataSet.Open;
, and check if the filtering problem persists.
Last edited by AndreyZ on Wed 04 Apr 2012 12:35, edited 1 time in total.

fgoutemant
Posts: 6
Joined: Wed 08 Sep 2010 07:01

escape character for underscore

Post by fgoutemant » Wed 04 Apr 2012 08:19

I have tried your code but unfortunately i have still a filtering problem.
here is my code :

ClientDataSet.Filter := 'number=''1_t*''';
ClientDataSet.FilterOptions := [foCaseInsensitive];
ClientDataSet.Filtered := True;

thanks for your help

AndreyZ

Post by AndreyZ » Wed 04 Apr 2012 12:39

I cannot reproduce the problem. Please specify the following:
- the script to create your table;
- the exact version of your IDE.

Post Reply