|Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread|
|Messages 1 to 5 of 5 total|
|Mon, Jun 9 2008 9:01 AM||Permanent Link|
Praveen A B
I recently upgraded from v3.20 to v4.26. I'm facing a problem with the OnFilterRecord event.
In v3.20, the OnFilterRecord event is fired ONLY once for each record in dataset.
In v4.26, the OnFilterRecord event is fired MORE THAN once for each record in dataset.
This causes the ACCEPTED record to FILTERED the second time, thus causing RECORDCOUNT = 0 issue.
Fields - person_num, company_num, person_name.
primary_key - person_num, company_num.
sec_key - person_name.
Say Table records -
person_num company_num person_name
-------------- ----------------- ----------------
1000 1000 ABC
1000 1100 ABC
1100 1000 ABC
GlobalStringList.Clear; --> To filter distinct values.
TABLE_1.IndexFieldNames := 'person_name';
TABLE_1.OnFilterRecord := SomeEvent;
TABLE_1.Filtered := TRUE;
TABLE_1.RecordCount ---> 0.
Accept := True;
if GlobalStringList.IndexOf(DataSet.FieldByName('person_name').AsString) = -1 then
Accept := False;
NOTE: The above code works fine in v3.20 but not v4.26
|Mon, Jun 9 2008 10:43 AM||Permanent Link|
I've just done a quick test here using 4.25 and that seems OK (haven't installed 4.26 since I'm migrating to ElevateDB) so it could be something else causing it to retrigger, or it could be a refresh/data change causing it. I think there were some changes between V3 & V4 to do with the OnFilter event.
I don't know why you're trying to do it, but if I understand what you're trying to do there's two simpler ways:
1. If you can use queries directly do that
2. If not use a query to produce the list of people to show and interrogate that eg
q1.sql.text := 'SELECT person_num, person_name FROM TABLE_1 GROUP BY person_name';
Accept := q1.Locate('person_num',DataSet.FieldByName('person_num').AsInteger,);
I'm using this approach in ElevateDB and it works really well, but it will be slower in DBISAM
3. Use a query to build a string holding person_num and put that in as a filter. This is the approach some of my DBISAM apps use
Roy Lambert [Team Elevate]
I'd like to know what you're actually trying to achieve
|Mon, Jun 9 2008 4:59 PM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
<< I recently upgraded from v3.20 to v4.26. I'm facing a problem with the
OnFilterRecord event. In v3.20, the OnFilterRecord event is fired ONLY once
for each record in dataset. In v4.26, the OnFilterRecord event is fired MORE
THAN once for each record in dataset. This causes the ACCEPTED record to
FILTERED the second time, thus causing RECORDCOUNT = 0 issue. >>
You cannot assume that the OnFilterRecord will be called in any particular
order, or any particular number of times, so changing data inside of this
event is a bad design idea. Unlike 3.x, 4.x fires the OnFilterRecord in
the process of executing a bulk table scan so that it can be included in the
record counts, and subsequently provide accurate record counts.
|Tue, Jun 10 2008 4:19 AM||Permanent Link|
Praveen A. B.
Please find attached an example of issue. DBISAM 4.26 and BDS 2006.
|Tue, Jun 10 2008 2:25 PM||Permanent Link|
That sample shows the action you were describing. Why not use one of my ideas to solve the issue?
Roy Lambert [Team Elevate]