Re: [web2py] Accessing records

2014-05-20 Thread Tom Russell
Woks perfect, thank you. On Tuesday, May 20, 2014 11:17:12 AM UTC-4, Anthony wrote: > > It is a Rows objects, so yes, you can iterate over it. > > Anthony > > On Tuesday, May 20, 2014 11:06:34 AM UTC-4, Tom Russell wrote: >> >> Thanks. >> >> What would last_five_records be, a list or something I c

Re: [web2py] Accessing records

2014-05-20 Thread Anthony
It is a Rows objects, so yes, you can iterate over it. Anthony On Tuesday, May 20, 2014 11:06:34 AM UTC-4, Tom Russell wrote: > > Thanks. > > What would last_five_records be, a list or something I could iterate over? > > Tom > > On Tuesday, May 20, 2014 10:16:54 AM UTC-4, Johann Spies wrote: >> >

Re: [web2py] Accessing records

2014-05-20 Thread Tom Russell
Thanks. What would last_five_records be, a list or something I could iterate over? Tom On Tuesday, May 20, 2014 10:16:54 AM UTC-4, Johann Spies wrote: > > > > > On 20 May 2014 16:11, Tom Russell >wrote: > >> I have a table which I insert data from the internet, just 4 records. >> Before inserti

Re: [web2py] Accessing records

2014-05-20 Thread Anthony
You could also include a creation and/or modified time in each record and reverse sort by that. On Tuesday, May 20, 2014 10:16:54 AM UTC-4, Johann Spies wrote: > > > > > On 20 May 2014 16:11, Tom Russell wrote: > >> I have a table which I insert data from the internet, just 4 records. >> Before

Re: [web2py] Accessing records

2014-05-20 Thread Johann Spies
On 20 May 2014 16:11, Tom Russell wrote: > I have a table which I insert data from the internet, just 4 records. > Before inserting though I need to get the last 5 rows of data from these 4 > fields and do a calculation with them. Then when I insert the data I add > one more field making it a tot

Re: [web2py] Accessing records

2014-05-20 Thread Tom Russell
Anthony, Thanks for the tips. I have a table which I insert data from the internet, just 4 records. Before inserting though I need to get the last 5 rows of data from these 4 fields and do a calculation with them. Then when I insert the data I add one more field making it a total of 5 fields I

Re: [web2py] Accessing records

2014-05-20 Thread Anthony
Note, there is no guarantee that the records in the db at any given time have sequential values in the ID field (e.g., when you delete a record, the value of its ID is then absent from the sequence of IDs). Can you explain in more detail what you are actually trying to do? Anthony On Tuesday,

Re: [web2py] Accessing records

2014-05-20 Thread Tom Russell
Thanks for the comments. I read Chapter 6 which is where I got the bit of code to access the records. I can ensure that there is records with those id's. Its a script that grabs data off from the internet and inserts that data into that table. Then I grab the last 5 records including the one it

Re: [web2py] Accessing records

2014-05-20 Thread Johann Spies
On 19 May 2014 22:06, Tom Russell wrote: I have some records in my db that I need to access to get them and perform > some calculations on. > > My code to access the records is: > > rows = db(db.voltrin.id > 0).count() > Let us assume rows = 100 at this point. > > currentrow = rows - 4 > cu

[web2py] Accessing records

2014-05-19 Thread Tom Russell
Hi, I have some records in my db that I need to access to get them and perform some calculations on. My code to access the records is: rows = db(db.voltrin.id > 0).count() currentrow = rows - 4 for x in range(currentrow, rows): record = db.voltrin(db.voltrin.id==x)