Dear all,

I have two mysql tables having the same entries in one of their fields 
(different number of rows though) and i want to link them using 
SQLFORM.smartgrid (or SQLFORM.grid if that's more convenient). I've defined 
the tables as such:

db.define_table('total_genes',
    Field('id','integer', label=T('id')),
    Field('gene_id','string', label=T('Contig')),
    Field('description','string', label=T('Gene name')),
    migrate=False)


db.define_table('total_ec_numbers',
    Field('id','integer', label=T('ID')),
    Field('description','string', 'reference total_genes', label=T('Gene 
name')),
    Field('hit_name','string', label=T('Hit name')),
    Field('hit_accession','string', label=T('Hit accession')),
    migrate=False)


in my default.py i've created this:

form=SQLFORM.smartgrid(db.total_ec_numbers, linked_tables=['total_genes'], 
create=False, deletable=False, editable=False, maxtextlength=64, 
paginate=10)


but even though the page displays the grid it doesn't display any link to 
the 'total_genes' entries. (in short i want each row of the total_ec_number 
table to have a link to the appropriate total_genes entries for which the 
description field has the same value)

Furthermore below the search query i get a link called total_ec_numbers*es 
*which 
is probably the plural that web2py recognises for my table's name. I tried 
to change that by redefining the table as such:


db.define_table('total_ec_numbers',
    Field('id','integer', label=T('ID')),
    Field('description','string', 'reference total_genes', label=T('Gene 
name')),
    Field('hit_name','string', label=T('Hit name')),
    Field('hit_accession','string', label=T('Hit accession')), 
single='total_ec_number', plural='total_ec_numbers',
    migrate=False)

but that didn't change anything.

Also I've tried using just SQLFORM.grid as such:

form=SQLFORM.grid(db.total_ec_numbers, 
left=db.total_genes.on(db.total_genes.description==db.total_ec_numbers.description),
 
create=False, deletable=False, editable=False, maxtextlength=64, 
paginate=10)

but with no luck. Still the grid is there but no links.

Does anyone have any idea how to achieve these links between my tables? 
What am I doing wrong?  

Thank you in advance,

-- 
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.

Reply via email to