escape character for underscore (_)

escape character for underscore (_)

Postby 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
fgoutemant
 
Posts: 6
Joined: Wed 08 Sep 2010 07:01

Postby 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.
AndreyZ
 

dataset filter error

Postby 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
fgoutemant
 
Posts: 6
Joined: Wed 08 Sep 2010 07:01

Postby 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.
AndreyZ
 

escape character for underscore

Postby 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
fgoutemant
 
Posts: 6
Joined: Wed 08 Sep 2010 07:01

Postby 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.
AndreyZ
 


Return to dbExpress driver for InterBase & Firebird