I have a fairly straight forward table, and a fairly easy db query:
db(db.segment.parent == request.vars.id).select()

For my use case, this returns a Rows object of 3 to 10 Row objects, and I 
do some simple calculations.
for row in rows:
  if row.x:
     term1 = row.term
  if row.y:
     term2  = row.term
return dict(rows=rows, mycalc = calc(term1,term2))



(ok, x is really "isstart" and y is "isstop", flags to mark endpoints, but 
that's being overly specific)

I'd also like to compute a delta between the row.term value of each row and 
it's predecessor (by data entry convention, the table is ordered by id). 
 So the 2 questions are:

   - can you tell the index in rows of the row you are working on?  (I 
   guess this is a Python question, not just web2py).  In js, the map and 
   reduce functions know the index in the array they have as input; is 
   something similar available in a Python iteration?
   - can you add fields to a Row object, or to the parent Rows object, and 
   have the view display it, or is a virtual field definition needed?

Thanks.

Dave S
/dps

-- 
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