Problem with filtering on a dataset

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
TopControl
Posts: 3
Joined: Tue 10 Nov 2015 10:18

Problem with filtering on a dataset

Post by TopControl » Tue 05 Apr 2016 12:28

Hello,
i got a problem with filtering records in a dataset with the interbase data access components v5.6.21 in delphi 2009. I use for filtering the filter property of these components and as filter string i put something like '_0%'. The problem here is that the dataset filters all records away instead of only these records who have set '0' for the second character of a certain field. After some testing i realized that this behavior only exists when i put the underscore '_' as first character of the filter string. As this filter has worked with the old version of the ibdac components (4.6.12) i have tested both versions with the same source
but only different versions of the ibdac components. It seems to be a problem with these new components. I tested with the normal TIBCQuery component and also with the VirtualTable (after assigning with an ibcquery).
Same thing.

The official Codegear documentation of the datasets and the filter properies says that the underscore should work and in fact it works with the original ib delphi components.

I prepared a sample project and a databasescript but unfortunately it can't be uploaded to this forum. Anyway, it just a simple IBCQuery with this SQL-Query inside:

Code: Select all

select r.id, r.state, r.some_data from test_records r
The State field is just a field of type VARCHAR(4).

After opening the dataset i set the filter to:

Code: Select all

  IBCQuery1.Filtered := False;
  IBCQuery1.Open;
...
  IBCQuery1.Filtered := False;
  // The Second character of field STATE must to be '0'
  IBCQuery1.Filter := 'STATE LIKE ' + QuotedStr('_0%');
  IBCQuery1.Filtered := True;

Now all records are filtered away.
If i use the string '0_0%' then it filters correctly. It shows me only those records whose first and third character of field STATE is '0'.

Do you have the possibility to check this? As a workaround i see only the solution to use the onFilterRecord Event.
I would have to change much code of my program, just to bring it back up running.

Best regards...

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Problem with filtering on a dataset

Post by ViktorV » Fri 08 Apr 2016 10:37

Thank you for the information. We have reproduced the problem and investigation is in progress. We will inform you when we have any results.

Post Reply