db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Hilka" <thi...@vps.de>
Subject AW: Finding position of previous selected record in new ordering
Date Fri, 16 Mar 2007 13:53:17 GMT

Thank you for the answer. But this was not quite what we were looking for.
The general limit/offset stuff works perfectly (by the way, I opened an
issue in which I posted our enhancements for MSSQL and Oracle).

Our Problem is to get the new position of an item after performing a select
statement with a different order by clause. 
We know the current position of the item and the item itself. But we want to
know the position of this item in the list of results (without retrieving
all results) if we would do a select with a different order by clause . And
after we got the position we would just perform a select statement and only
get a window (e.g. 20 items before and 20 items after the selected item)
around this item.

Is this possible?

Best regards,


-----Ursprüngliche Nachricht-----
Von: Greg Monroe [mailto:Greg.Monroe@DukeCE.com] 
Gesendet: Freitag, 16. März 2007 14:35
An: Apache Torque Developers List
Betreff: RE: Finding position of previous selected record in new ordering

You can use Criteria.setOffset to define the start point and
Criteria.setLimit to define the number of records to return.  This gets
translated into the appropriate DB server specific select.  But test and
verify that it work

with your specific DB since there were issues with various DB prior to
3.3 (but I think they have been worked out now).
Also, you might look at the LargeSelect utility class.  This does the same
thing but also has some performance/ease of use enhancements like caching
serveral pages, being able to select by page, supplying page counts and the


	From: Tobias Hilka [mailto:thilka@vps.de] 
	Sent: Friday, March 16, 2007 4:40 AM
	To: Apache Torque Developers List
	Subject: Finding position of previous selected record in new
	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.
	Thank you for your help.

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are
confidential communication or may otherwise be privileged or confidential
and are intended solely for the individual or entity to whom they are
addressed.  If you are not the intended recipient you may not rely on the
contents of this email or any attachments, and we ask that you  please not
read, copy or retransmit this communication, but reply to the sender and
destroy the email, its contents, and all copies thereof immediately.  Any
unauthorized dissemination, distribution or copying of this communication is
strictly prohibited.

View raw message