Please...I have some dificult in do this in web2py...as follow
db.define_table("cidadao"
,Field('CD_CIDADAO',type='id',
label='Cidadão(PK)')
,Field('CD_MATRICULA',type='integer',notnull=True,label='Matrícula')
,Field('NM_CIDADAO',type='string',notnull=True,label='Nome')
,format = '%(NM_CIDADAO)s'
,singular = 'cidadao'
,plural = 'cidadaos'
,migrate=False)
db.define_table("representante"
,Field('ID_REPRESENTANTE',type='id',readable=False)
,Field('ID_CARGOS',type='integer',notnull=True,label='Cargo')
,Field('CD_CIDADAO',type='string',notnull=True,label='Matrícula')
,Field('DT_INCLUSAO',type='datetime',notnull=True,label='Inclusão')
,Field('DT_EXCLUSAO',type='datetime',notnull=False,label='Exclusão')
,Field('CD_TELEFONE',type='string',notnull=True,label='Telefone')
,Field('CD_EMAIL',type='string',notnull=True,label='Email')
,Field('CD_CELULAR',type='string',notnull=False,label='Celular')
,migrate=False)
db.representante.CD_CIDADAO.requires = IS_IN_DB(db, 'cidadao.CD_CIDADAO',
'%(CD_MATRICULA)s - %(NM_CIDADAO)s')
db.representante.ID_CARGOS.requires = IS_IN_DB(db, 'cargos.ID_CARGOS',
'%(NOME)s')
db.define_table("gtils_representante"
,Field('ID',type='id',readable=False)
,Field('ID_GTIL',readable=True,label='GTIL')
,Field('ID_REPRESENTANTE',readable=True,label='Representante')
,Field('DT_INICIO',type='datetime',notnull=True,label='Início')
,Field('DT_TERMINO',type='datetime',notnull=False,label='Término')
,migrate=False)
db.gtils_representante.ID_GTIL.requires = IS_IN_DB(db, 'gtils.ID_GTIL',
'%(NOME)s')
How can i fill ID_REPRESENTANTE but show NM_CIDADAO (table cidadao) once i
don't have this field in "representante" table...?? or how can i put a
computed field in 'representant' table filled with the result choice of
the CD_CIDADAO. Thanks alot