db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl ...@apache.org>
Subject Re: Finding position of previous selected record in new ordering
Date Sat, 17 Mar 2007 10:17:43 GMT
Tobias Hilka wrote:
> Hello everyone,
> we are facing the following problem:
> We have a grid with many entries (up to several 100 000 entries). For
> performance reasons we only select the window which is visible for the
> user (about 50 entries). The rest of the grid is initialized with
> null-Items. So far so good.
> But now our problem: If we do order the grid by firstname ascending and
> select the fith entry, then we order the by the same column descending,
> we want the selection to persist and therefore we want the selection
> window to contain the selected entry in its new environment (e.g.
> position 99 950 to 100 000 and select record number 99 996).
> Is there any possibility to express this in torque? We know about some
> special features of some databases which can handle this. And I think
> there are features in SQL 2003 for this.

This is more a general Java problem that a special Torque one, I guess.
Say, you have a total of 100000 records. Your selected entry in
ascending sort order is number 67, your window goes from record number
51 to 100 (the second page). If you can be sure that your descending
sort order is exactly reverse, you can calculate the page number your
record will be in by (roughly)

	ceil((100000 - 67)/50) = 1999

Then you can use LargeSelect to access page number 1999 and your
selected record should be in there. (Maybe one page off,but you get the

Bye, Thomas.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message