Filter TStringfield containing a backslash is not working anymore

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
WIZZ
Posts: 9
Joined: Thu 01 Mar 2012 19:49

Filter TStringfield containing a backslash is not working anymore

Post by WIZZ » Fri 27 Dec 2013 07:45

Hi,

Since my upgrade to version MyDAC 8.x the filter set on a TMyTable isn't working as expected anymore.
Set in Object Inspector (Delphi XE2 + MyDAC 8.2.5):
Filter: MyID='MyID' and MyFolder='C:\Program Files\MyApp\'
Filtered: True

Whenever a filter-value contains a "\", the filter doesn't recognize the value to be filtered.
So 'C:\Program Files\MyApp\' will not be found anymore.
MyID and MyFolder are both TStringField

Do you have a solution for this?

AndreyZ

Re: Filter TStringfield containing a backslash is not working anymore

Post by AndreyZ » Fri 27 Dec 2013 10:23

Hello,

You can avoid this problem in two ways:
1. double the slash symbol in the Filter property. Here is an example:

Code: Select all

Filter: MyID='MyID' and MyFolder='C:\\Program Files\\MyApp\\'
2. set the TMyTable.FilterOptions property to foNoPartialCompare. Here is an example:

Code: Select all

MyTable.FilterOptions := [foNoPartialCompare];
We will return an old behaviour in the next MyDAC build.

WIZZ
Posts: 9
Joined: Thu 01 Mar 2012 19:49

Re: Filter TStringfield containing a backslash is not working anymore

Post by WIZZ » Fri 27 Dec 2013 12:23

Thank you very much. Your solution works perfectly.

AndreyZ

Re: Filter TStringfield containing a backslash is not working anymore

Post by AndreyZ » Fri 27 Dec 2013 15:33

You are welcome. If any other questions come up, please contact us.

Post Reply