That looks like an improvement Anthony but now receive this error

<type 'exceptions.TypeError'> format requires a mapping

There is data in all of the fields (there are no "None" values).

The represent  field names the above table are as follows:

db.PhoneNumber.countryTelephoneCode.represent = lambda id, r: 
'%(countryTelephoneCode)s 
%(countryName)s' % db.Country(id)

any ideas?

thanks,

Alex

On Wednesday, April 24, 2013 10:47:07 AM UTC-7, Anthony wrote:
>
> Sorry, try:
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
>     lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.Country(
> id)
>
> Anthony
>
> On Wednesday, April 24, 2013 1:18:51 PM UTC-4, Alex Glaros wrote:
>>
>> Anthony, doesn't there have to be some sort of pointer to the correct 
>> reference record in the lookup table?
>>
>> Here is a real example below (different fields and table than first 
>> example).
>>
>> I tried to put "db.Country" in front of the lookup table field names in 
>> the "represent" clause, but the syntax is wrong.  Now that you can see the 
>> lookup table, could you please write out the complete syntax?
>>
>> db.define_table('Country', ## Lookup table
>> Field('countryName','string'), 
>> Field('countryCode','string'),
>> Field('countryTelephoneCode','integer'))
>> ## 
>> ----------------------------------------------------------------------------------
>> db.define_table('PhoneNumber',
>> Field('countryTelephoneCode','reference Country'), 
>> Field('telephoneNumber','integer'))
>> ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> db.PhoneNumber.countryTelephoneCode.represent = lambda v, r: 
>> '%(db.Country.countryTelephoneCode)s 
>> %(db.Country.countryName)s' % r
>>
>> Thanks,
>>
>> Alex
>>
>>
>> On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:
>>>
>>> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
>>>     lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r
>>>
>>> Anthony
>>>
>>> On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>>>>
>>>> Is there a way to concatenate fields in the represent function in the 
>>>> same way that countryTelephoneCode and countryName are in the "requires" 
>>>> validator below?
>>>>
>>>> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires =IS_IN_DB
>>>> (db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
>>>> countryName)s',zero=T('choose one'))
>>>>
>>>> thanks,
>>>>
>>>> Alex Glaros
>>>>
>>>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to