I am using the same orderby whether using limitby or not, as I stated. 
 Thus, using orderby alone, I should get the same first 20 records in the 
same order as I would get by using limitby(0,20); I am not (again, as 
shown)  In fact, I get the same sequence using limitby(0,20) as appears on 
the first page of the SQLFORM.grid when sorted on the appropriate column.

On Monday, December 12, 2016 at 1:42:57 PM UTC-5, Richard wrote:
>
> Hello Scott,
>
> I am not sure I understand the problem... But for sure limit by alone will 
> never return you the same set of results as you didn't specify the order in 
> which you want the result to be and the analyser just favor the faster 
> quering path... So don't expect limitby alone to return the same set of 
> data each time you query the database, if it happen to be the same set it 
> just matter of chance. By using orederby you should see your problem go 
> away except if you really had found an issue that would be implementation 
> specific as you seems to point us in that direction. You can orderby over 
> table id if you have not special requirement on that matter.
>
> Richard
>
> On Sun, Dec 11, 2016 at 11:49 PM, Scott Hunter <shu...@nycap.rr.com 
> <javascript:>> wrote:
>
>> I'm using a SQLFORM.grid, using a query of the form:
>>
>>     db.t_dog.id.belongs(dog_ids)
>>
>>
>>
>> But the listing is erratic; some records only appear when the list is 
>> sorted certain ways (except for the last page); entries on each page are in 
>> order, but entries between pages overlap.
>>
>> I thought the problem might be how grid uses limit by to get the records 
>> for a given pages, and sure enough, if I do the query myself, the query 
>> results match what appears on each page.
>>
>> For example, when sorting by code #, the start of the whole result looks 
>> like:
>>
>>     99 Test Collie 2
>>>     1350 Tovah Border Collie 2
>>>     1582 Lexi Border Collie 2
>>>     
>>> *1702 Bean Border Collie 2*
>>>
>>>
>>> *    1704 Ginger Border Collie 2    3865 Owen Border Collie 2    4099 
>>> Flirt Border Collie 2**    5169 Super G Border Collie 2*
>>>     5199 Emme Border Collie 2
>>>     5202 Beamer Border Collie 2
>>>    * 5203 Audie Border Collie 2*
>>
>>
>> But using limitby(0,20), I get:
>>
>>     1702 Bean Border Collie 2
>>>     1704 Ginger Border Collie 2
>>>     3865 Owen Border Collie 2
>>>     4099 Flirt Border Collie 2
>>>     5169 Super G Border Collie 2
>>>     5203 Audie Border Collie 2
>>
>>
>> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to