I use this formula to determine the quantity of records visible in a grid:

nGridRowQty = int( (thisform.grid1.height - thisform.grid1.headerheight) / thisform.grid1.rowheight)

This gives you a very good estimate of the quantity of records that will be visible in a grid with fontname= Arial and fontsize=9

You can use this number in a statement such as this:

Text to cCmd textmerge noshow flags 2 pretext 15

         Select top << nGridRowQty >> * from << cTable >>
         order by << cOrderField >> asc
        into cursor curWhatever readwrite nofilter

EndText

&cCmd

where cTable is the name of the table the cursor is gotten from and cOrderField is the field you would sort the cursor by.

The above will bring only a subset of records that will be visible in the grid, regardless of how many records meet the filter condition

I use this in my pagination class, to bring only the quantity of records visible at any time, improving performance and diminishing network traffic.

Rafael Copquin



El 24/10/2013 10:24, Alan Bourke escribió:
So I have a grid with a cursor behind it. The active index on the cursor
can be changed by the user, thus sorting the grid in different ways.

Is there any easy way of determine the subset of records visible in the
grid at any given time?




_______________________________________________
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/526924d2.5030...@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