Page 1 of 1
escape character for underscore (_)
Posted: Thu 29 Mar 2012 08:45
by fgoutemant
I need to know if it is possible to use a escape character for underscore to use it in ClientDataSet.Filter
Thanks
Posted: Thu 29 Mar 2012 15:40
by AndreyZ
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.
dataset filter error
Posted: Tue 03 Apr 2012 06:58
by fgoutemant
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
Posted: Wed 04 Apr 2012 07:58
by AndreyZ
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.
escape character for underscore
Posted: Wed 04 Apr 2012 08:19
by fgoutemant
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
Posted: Wed 04 Apr 2012 12:39
by AndreyZ
I cannot reproduce the problem. Please specify the following:
- the script to create your table;
- the exact version of your IDE.