For counting SkillLevels that match a Skill with name "toto" you can use this:
if db((db.SkillLevel.Skill == db.SkillLevel.id) & (db.Skill.Nom == "toto")).count() == 0: Select the first item by Nom (for Nome a string): # you can make .last() or simply .select(), which will return a Rows object with # the sequence of records that match the query if found db(db.item.Nom == <Nom value>).select().first() Add a record to demande: db.Demande.insert(Topic=<topic value>, Texte=<texte value>, ...) On Thursday, March 29, 2012 7:20:31 AM UTC-3, bussiere adrien wrote: > > Thanks to you my project make nice progress : > http://img26.imageshack.us/img26/1271/loginscreena.png > > But i need to know some things : > here is my database : > > > db.define_table('Skill', > Field('Nom', unique=True), > format = '%(Nom)s') > > db.define_table('SkillLevel', > Field('Level', 'integer'), > Field('Skill', db.Skill), > Field('Parent', db.Skill), > format = '%(Skill)s') > > > and : > if db(db.SkillLevel.Skill.Nom == ''toto").count() == 0: > > Don't work i says to me skill have no nom attribute > > > then an other question : > db.define_table('Demande', > Field('Topic', unique=True), > Field('Texte'), > Field('Skills','list:reference SkillDemande'), > Field('Items','list:reference Item'), > Field('auth_user',db.auth_user), > format = '%(Topic)s') > > > db.define_table('Item', > Field('Nom', unique=True), > Field('SkillUse', db.SkillLevel), > format = '%(Nom)s') > > > How to select an item by Nom ? > How to add an item in demande ? > > regards > Bussiere >