Thanks Massimo!
The following code worked for me
db.table.id.represent = lambda value: A(db
(db.table.id==value).select(db.table.field2)[0].field2,_href=URL
(r=request,f='update',args=value)) if len(db(db.table.id==value).select
(db.table.field2))>0 else A('None',_href=URL
(r=request,f='create',args='None'))
On Apr 20, 4:23 pm, mdipierro <[email protected]> wrote:
> I think you just need
>
> db.table.id.represent = lambda value: A(db.table
> [value].field2,_href=URL(r=request,f='edit',args=value))
>
> On 20 Apr, 08:55, Hans <[email protected]> wrote:
>
> > The repesent code below produces following A title output:
> > 'table.field2 123.456' if the field2 value is 123.456 and
> > 'table.field2' if the field2 value is None
>
> > What I want to achieve is following A title output:
> > '123.456' if the field2 value is 123.456 and
> > 'None' if the field2 value is None
>
> > How can this be achieved?
>
> > Thanks,
> > Hans
>
> > db.table.id.represent = lambda value: A('%s' % (db
> > (db.table.id==value).select(db.table.field2)),_href=URL
> > (r=request,f='edit',args=value))
>
> > records=SQLTABLE(db(query).select(
> > db.table2.code,
> > db.table3.code,
> > db.table.id,
> > left=[db.table2.on(rows_table2),
> > db.table3.on(rows_table3),
> > db.table.on(rows_table)
> > ],
> > orderby=db.table3.code|db.table2.code),
> > headers=headers
> > )
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---