.select() returns a Rows object, even if it contains just a single row. 
Instead, it should be:

row = db(db.voltrin.startdate == mydate).select()[0]

or better:

row = db(db.voltrin.startdate == mydate).select().first()

.first() returns None in case no records are returned, which would cause an 
error when using a subscript.

Anthony

On Monday, August 18, 2014 11:09:37 AM UTC-4, Tom Russell wrote:
>
> I have some simple code that is suppose to grab data from a row in my db 
> table.
>
> I do it like:
>
> row = db(db.voltrin.startdate == mydate).select()
> vwtrin = row.vw_trin
>
> I have run this and verified mydate and whatever other variables I have 
> are something other than null but I cannot seem to get the data for the 
> field in my code above. I can see in the pycharm debugger that the row has 
> the colnames listed but I do not see any records or values.
>
> Am I doing this right?
>
> Thanks,
>
> Tom
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to