I tried the solutions suggested here, (yours Ted and others) Instantaneous means less than one second. This is for showing, at the end of each record, the record number as a page number like this:

page 245 of 1234987

As the user navigates the table up or down, top or bottom, the "page" number (really the record in the order it appears) would be shown.

I solved it thus:

Select * from bigtable where (filter condition) order by compname into cursor curFiltered readwrite

I chose not to create an empy placeholderfield, because I found it is not necessary. Instead I wrote four methods in my form: movetop,movebottom,moveprevious,movenext, like this:

**movetop method   (triggered by home key)
select curFiltered
go top
thisform.nRecNo = 1

** movebottom method     (triggered by end key)
select curFiltered
go bottom
thisform.nRecNo = reccount('curFiltered')

**movenext method     ( triggered by page down key)
select curFiltered

 if not eof()
     Skip
     thisfor.nRecNo = thisform.nRecNo + 1
     if eof()
         Go bottom
         thisform.nRecNo = Reccount('curList')
     endif
 else
     go top
     thisform.nRecNo = 1
 EndIf

**moveprevious method    (triggered by pageup key)

similar to movenext but skip -1 and bof() instead of eof()

and in the method that shows the label Page NN of XX I simply show thisform.nRecNo

It is a very simple and superfast approach.

BTW, I found that if the filter condition uses LIKE instead of = it goes much faster.

select * from clients where alltrim(city) = 'SAN ANTONIO' took 1.872 seconds
select * from clients where alltrim(city) like 'SAN ANTONIO%' took 0.219 seconds select * from clients where alltrim(city) like 'SAN ANTONIO' took 0.202 seconds

That table has 887084 records and it has 44 fields. The city field is indexed on alltrim(city)

Notice that if I remove the % at the end of the LIKE clause, it is even faster.

I wonder why the LIKE clause is faster than the = operator

Rafael Copquin

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/546e2c97.9060...@fibertel.com.ar
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to