Should'd that be override_code = override[k].ceo_schemes_and_overrides_and_override_codes. override_code.code1
anyway this should be faster (no nested queries) override = db((db.ceo_schemes_and_overrides_and_override_codes.ceo_scheme == ceo_scheme.id) & (db.ceo_schemes_and_overrides_and_override_codes.override == override_id)).select(left=db.override_code.on(db. ceo_schemes_and_overrides_and_override_codes. override_code==db.override_code.id)) override_code = override[k].override_code.code1 On Saturday, 22 August 2015 07:41:35 UTC-5, Gael Princivalle wrote: > > Hello. > > I've make a many to many to many relationship but I've got problems on > select results. > Is it the correct way to do it? > My DB: > db.define_table('ceo_schemes', > Field('name', type='string', requires=IS_NOT_EMPTY()), > format='%(name)s') > db.define_table('overrides', > Field('name', type='string', requires=IS_NOT_EMPTY()), > format='%(name)s') > db.define_table('override_codes', > Field('code1', type='string'), > Field('code2', type='string'), > format='%(code1)s %(code2)s') > db.define_table('ceo_schemes_and_overrides_and_override_codes', > Field('ceo_scheme', 'reference ceo_schemes'), > Field('override', 'reference overrides'), > Field('override_code', 'reference override_codes')) > > My controller: > override = db((db.ceo_schemes_and_overrides_and_override_codes.ceo_scheme > == ceo_scheme.id) & (db.ceo_schemes_and_overrides_and_override_codes. > override == override_id)).select() > > In my view I can see this result with BEAUTIFY(response._vars): > override:"ceo_schemes_and_overrides_and_override_codes"."id" > "ceo_schemes_and_overrides_and_override_codes"."ceo_scheme" > "ceo_schemes_and_overrides_and_override_codes"."override" > "ceo_schemes_and_overrides_and_override_codes"."override_code"302_DWithout > 20 > > But in the controller if I call: > override_code = override.ceo_schemes_and_overrides_and_override_codes. > override_code.code1 > > The ticket is : > 'Rows' object has no attribute > 'ceo_schemes_and_overrides_and_override_codes' > > Someone knows why? Is is the way that I've done the 3 tables relations > ship that's wrong? > > Thanks. > > -- 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.