Yes, Arjun you are right you are comparing row object to a string.so first you have to extract value from row object.
You can use first or last function to get values. if measure_1.first()['name']=='DBD': instead, store a row object in variables you can store values which you want to compare. measure_1 = db(db.Detailed_Info.MEMBER_NBR==form.vars.name).select(db.Detailed_Info.MEASURE_1).frist()['name'] Hope this helps you! On Fri, Dec 7, 2018 at 1:13 PM <arjunmja...@gmail.com> wrote: > 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 web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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.