My attempts to help inline below.
2014/1/14 DAL read and variables <[email protected]> > Hi guys, > > this question is about tree things at once. > The first on is as follow: > I have this code: > > [code] > > in the models (not so importantthis part works fine): > > dba = DAL('mysql://web2py:test@localhost/testdb') > dba.define_table('person', Field('name', requires=IS_NOT_EMPTY()), > Field('email', requires=IS_NOT_EMPTY())) > > > in the controller: > > > def index(): > a = 'Hallo Besucher. Wie geht es ihnen?' > b = 'Hier kann man Daten eingeben. ', URL('eingeben') > c = 'Hier kann man daten ausgeben' > > b = A('Hier kann man Daten eingeben. ', _href=URL('eingeben')) > return dict( Welcome=a, eingabe=b, showdata=c) > > def eingeben(): > form = SQLFORM(dba.person) > form.add_button('records', URL('ausgabe')) > if form.process().accepted: > session.flash = 'form accepted' > redirect(URL('ausgabe')) > elif form.errors: > response.flash = 'form has errors' > else: > response.flash = 'please fill out the form' > > return dict(form=form) > > def ausgabe(): > a = 4 > records = SQLTABLE(dba(dba.person._id== 1).select(dba.person.name > ),headers='fieldname:capitalize') > return dict(records=records) > > # I think I do not fully understand what is the problem but I try ;-) def ausgabe(): a = 4 records = SQLTABLE(dba(dba.person._id== a).select(dba.person.name ),headers='fieldname:capitalize') newvariable = records[0].name return dict(records=records) [/code] > > 1. in def index(), you see this: > b = 'Hier kann man Daten eingeben. ', URL('eingeben') > but this does not work fine, i want to get a link with the text "Hier kann > man Daten eingeben." and a link to "eingeben" > > 2. in def ausgabe(), you see this: > > variable = 4 > records = SQLTABLE(dba(dba.person._id== variable).select( > dba.person.name),headers='fieldname:capitalize') > it should work like this, the variable in the first line should be used in > the dba.person._id==variable > > > 3. > def ausgabe(): > a = 4 > records = SQLTABLE(dba(dba.person._id== 1).select(dba.person.name > ),headers='fieldname:capitalize') > return dict(records=records) > > ok, lets assume, the first line in the data bank is 1 marc [email protected] > > the code on the top leeds to the following output: > Name > marc > > is there some way to get a variable like > newvariable = 'marc' > > > I hope you can help me, i spent hours in trying, but i didn't found > anything that helped me. the handbook doesnt cover such basic stuff , or i > didn't found it :( > > Thank you very much, > Darren > > -- > 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/groups/opt_out. > -- 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/groups/opt_out.

