In my model I defined the following tables:

db.define_table('css_selectorproperty',
    Field('selector',length=48,default='',notnull=True),
    Field('property',length=36,default='',notnull=True),
    Field('name',length=84,default='',notnull=True),
    Field('inquery',type='boolean',default='True'),
    migrate=False)


db.define_table('css_declaration',
 
Field('bedrijf_id',db.bedrijf,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
 
Field('selectorproperty_id',db.css_selectorproperty,default='',notnull=True,ondelete='CASCADE'),
    Field('value',length=48,default='',notnull=True),
    migrate=False)


In a function I would like to join the two tables without loosing any
selectorproperties:

@auth.requires_membership('card')
def manage_css():
 
rows=db().select(db.css_selectorproperty.ALL,db.css_declaration.ALL,\
 
left=db.css_declaration.on((db.css_selectorproperty.id==db.css_declaration.selectorproperty_id)&
\
 
(db.css_declaration.bedrijf_id==auth.user.bedrijf_id)&(db.css_selectorproperty.inquery==True)),
\
    orderby=db.css_selectorproperty.id)
    return dict(rows=rows)

The left outer join:

left=db.css_declaration.on((db.css_selectorproperty.id==db.css_declaration.selectorproperty_id)

... and the first condition:
(db.css_declaration.bedrijf_id==auth.user.bedrijf_id)

both work, however, the second condition:

(db.css_selectorproperty.inquery==True)

... doesn't work. rows also contains the records that have inquery set
to False. I have no idea why, I hope one of you has.


Kind regards,

Annet.

Reply via email to