Oh no, the code above failed. Here is the final code where n is the week number: {{for record in db().select(db.table.ALL, orderby=db.table.day, limitby=((n-1)*7, n*7)):}}
On Dec 18, 1:30 am, Rick <sababa.sab...@gmail.com> wrote: > Sorry for spamming, but I want to be exact. Here is the final code, > where n is the week number: > {{for record in db().select(db.table.ALL, orderby=db.table.day, > limitby=(n*0, n*7)):}} > > On Dec 18, 1:24 am, Rick <sababa.sab...@gmail.com> wrote: > > > > > > > > > Thanks a lot! The final code looks like this: > > {{for record in db().select(db.table.ALL, orderby=db.table.day, > > limitby=(0, 7)):}} > > > On Dec 18, 12:59 am, Luther Goh Lu Feng <elf...@yahoo.com> wrote: > > > > Fromhttp://web2py.com/book/default/chapter/06#orderby,-groupby,-limitby,-... > > > > I think the following may work: > > > > for row in db().select(db.table.ALL, limitby=(0, 7)): > > > print row.record > > > > for row in db().select(db.table.ALL, limitby=(0, 3). > > > orderby=~db.table.id): > > > print row.record > > > > On Dec 18, 7:30 am, Rick <sababa.sab...@gmail.com> wrote: > > > > > Hi, > > > > > In the database there are value records for 31 days. Now I'm trying to > > > > make a html file where a value is presented for each day of a week. > > > > The code below presents all the recorded values, and I don't know how > > > > to make it printing the 7 first records only, or the last 3 records. > > > > > Thanks in advance for help. > > > > > <table> > > > > <tr> > > > > <td>Day| <br> Value| </td> > > > > {{for record in records:}} > > > > <td>{{=record.day}} <br> {{=record.value}}</td> > > > > {{pass}} > > > > </tr> > > > > </table>