I am writing a simple web2py application and can't seem to figure out how
to run comparison checks on variables from db.select statements. Code is
posted below:
form = FORM('Enter Member ID: ', INPUT(_type='text', _name='name'),
INPUT(_type='submit', _value='submit'))
if form.accepts(request, session):
member_id= form.vars.name
measure_1 =
db(db.Detailed_Info.MEMBER_NBR==form.vars.name).select(db.Detailed_Info.MEASURE_1)
measure_2 =
db(db.Detailed_Info.MEMBER_NBR==form.vars.name).select(db.Detailed_Info.MEASURE_2)
response.flash = 'Form Accepted'
if measure_1=='DBD':
test = 'IT WORKED'else:
test = 'IT DIDNT WORK'
return dict(form=form, test=test)
My question is, I am able to see that the value from the first select statement
(that defines variable measure_1) is in fact 'DBD'. But the if statement
conditional at the bottom isn't working. I feel it's because the result of the
select statement is a "row" object. Is there a way to extract the actual value?
Thank you!
down votefavorI am writing a simple web2py application and can't seem to
figure out how to run comparison checks on variables from db.select
statements. Code is posted below:
<https://stackoverflow.com/questions/53547608/web2py-extract-value-from-row-object-and-store-in-variable#>
--
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.