db.define_table('Party', ## super-type for people and organizations
Field('partyTypeID','reference PartyType'),
Field('displayName','string'))
db.define_table('Country',
Field('countryName','string'),
Field('countryCode','string'),
Field('countryTelephoneCode','integer'))
db.define_table('PartyPhoneNumberIntersection',
Field('partyID','reference Party'),
Field('countryTelephoneCode','integer'),
Field('telephoneNumber','integer'))
db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = lambda id,row: db.Country(countryTelephoneCode).countryName ## this generates an error: "global name 'countryTelephoneCode' is not defined" How can I fix this represent syntax?db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = lambda id,row: db.Country(row.countryTelephoneCode).countryName
What is the represent feature syntax for having countryName appear in place of countryTelephoneCode using the represent feature?
Notice in the above situation that countryTelephoneCode is not the primary key of the Country table.
db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = lambda id,row:
db(db.Country.countryTelephoneCode == row.countryTelephoneCode).select().first().countryName
db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = lambda id,row:
db.Country(countryTelephoneCode=row.countryTelephoneCode).countryName--
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/X3yCo4Vwqew/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.