Got it working. I had to change a few things that were totally wrong. In a
nutshell:
1. added:
format='%(suppliercode)s')
to my supplier table
2. my represent field ended up being this:
Field('supptile','reference product',represent=lambda id, r: '%s %s'% (r.
supplier.suppliercode,r.product.tilename)),
On Monday, July 8, 2013 10:13:55 PM UTC-7, greenpoise wrote:
>
> My bad for the confusion. I need suppliercode(not the id) and the tilename
> concatenated. What I noticed is that my third table (product), the one that
> has tilename, has no relationship with the supplier table.
>
> So, one series contains one supplier..and products are tied to one
> supplier which will have its suppliercode. I just dont see the use of tying
> products with supplier table...I dont know how best I can describe it..
>
>
>
> On Monday, July 8, 2013 6:40:03 PM UTC-7, Anthony wrote:
>>
>>
>> db.define_table('series',
>>> Field('supplier','reference supplier'),
>>> Field('suppcode',represent=lambda id, r: '%s %s' % (r.series.
>>> suppliercode, r.product.tilename)),
>>>
>>
>> Can you explain what you want to display? r refers the the row from the
>> series table, so your code should refer to fields in the series table.
>> Instead of r.series.suppliercode, perhaps you want r.supplier.suppliercode.
>> Not sure what you want with r.product.tilename -- there is no product field
>> in the series table, nor a tilename field in the product table. Also, what
>> does suppcode store? If it stores the content of db.supplier.suppliercode,
>> why the redundancy -- you can already access that value via the
>> db.series.supplier reference field?
>>
>> Anthony
>>
>
--
---
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.