Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

OnFilterRecord and DBGrid?

Posted on 2002-06-12
11
Medium Priority
?
735 Views
Last Modified: 2010-04-04
Hello, Everyone.

Im using the OnFilterRecord Event on a Paradox Table. Has anyone noticed even though if Filtered=false for the Table, the DBGrid scrolls slower? If I take off the OnFilterRecod event from code,it will go back to normal fast scrolling speed.

Its just weird, when Filtered is set to false it deosn't even goto any line in that event. So why does it become slow? The scrolling is even faster when Filter=true.


So go figure........it should be the other way around. Filtering should make things slower ;-)

Any suggestions are very welcome.

Thanks very much.

P.S
Im using a Table with about 30,000 records.And a Intel P3 1gz, with 256mb ram , and gb's of free disk space. The key is using a very large Table.

If you would like to test , try using a very large
Table . Set the Filtered property to false during design time, and add some commented lines to the OnFilterRecord Event(no real code is needed there , its just to make the event exist) . Now compile and run , you should have the same results.

 


0
Comment
Question by:superpower
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7074742
? weird ... listening
0
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 7074748
Try this to avoid evaluation

Table1.OnFilterRecord := nil;

Best Regards.
Marcos.
0
 

Author Comment

by:superpower
ID: 7076123
Hello,

No , I never get to this situation.

Table1.OnFilterRecord := nil;

Any other ideas?


BTW, it isnt as slow if I use a smaller Table. If you would like to test , try using a fairly large Table (more than 1000 records at least), set the Filtered property to false during design time, and only add code the OnFilterRecord Event . Now compile and run , you should have the same results.


Thanks.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:kretzschmar
ID: 7076163
>you should have the same results
no, i have no difference (maybe my workstation is too fast)
0
 

Author Comment

by:superpower
ID: 7076167
P.S

On the other hand, for tests try to use a Table with close enough records to 30,000 just as Im testing with :-)

If you dont have one, you experts know how to make one through a loop .
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7077373
Well I just tested with 30,000 records with and without an OnFilterRecord on a Paradox table and there appeared to be no difference in the srolling speed.

PII 450 384MB's RAM Win2000


The Crazy One
0
 

Author Comment

by:superpower
ID: 7078966
Hello,

Here is the code I used,just to better illustrate.

unit cfilter;
   {Delphi3 Pro, also tried D5}
interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 Grids, DBGrids, Db, DBTables;

type
 TForm1 = class(TForm)
   Table1: TTable;

{40,000 record table(about 30field Table), Filtered Property is set to false , and Active is set to true during design time}

{same table structure with 8,000 records isnt so harshly
effected}

   DataSource1: TDataSource;
   DBGrid1: TDBGrid;
   procedure Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Table1FilterRecord(DataSet: TDataSet;
 var Accept: Boolean);
begin

{testing lines}
{take comments out and watch how fast the scrolling speed becomes}

end;

end.
0
 

Author Comment

by:superpower
ID: 7079457
P.S

Problem solved by myself just before I ran out of hope. This was one that really got me stuck.

I found a work around to this bug(It maybe so, or not) , becuase of all the code samples for OnFilterRecord in books, websites that Ive looked at ,had no such mention to do this.

On the OnShow event of the Form I just use

Table1.OnFilterRecord:=nil;

It seems Delphi doesn't like that event to be linked , when Filtered=false and some code exists in that event. So I unlink it. And call it back when I want the filtering to start.

Table1.OnFilterRecord := Table1FilterRecord;
Table1.Filtered=true;

But this was a rather tricky one. Becuase anyone trying the code on even a 10,000 record Table wouldnt even seen any difference. It had to be a 30k or 40k record Table with 30fields , in my case.


So do I get those points :-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7079466
really curious, because i could not reproduce

glad you had it solved yourself

ask at community-support for keep this q
into paq and refunds your points

meikl ;-)
0
 

Author Comment

by:superpower
ID: 7094392
Thank everyon for trying to help anyway. Still appreciated.

meikl,

But I have one question coming up that maybe you can answer. :-) So il recycle these pionts I get back.
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 7094569
Thanks all.  200 points refunded, item moved to our PAQ at zero points and closed.
Moondancer - EE Moderator
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question