I just implemented record representation such as the table below. My 
question is, is record representation supposed to save the value in the 
database? I am trying to create a price override field in my product table 
because the price can be changed within the series of a product (on the 
series table) or within the product itself on discriminatory occasions. Is 
Record Representation what I need???  Thanks

db.define_table('series',
   Field('seriesname'),
   Field('seriesdescription'),
   Field('colorgroup','reference colorgroup'),
   Field('material', 'reference material'),
   Field('price')
db.series.seriesname.requires = IS_NOT_IN_DB(db,db.series.seriesname)
db.series.colorgroup.requires = IS_IN_DB(db,db.colorgroup.id,'%(groupname)s'
)
db.series._singular = "Series"
db.series._plural = "+Series"
       
db.define_table('product',
   Field('series', 'reference series'),
   Field('finish', 'reference finish'),
   Field('cut', 'reference cut'),
   Field('price')
db.product.series.requires = IS_EMPTY_OR(IS_IN_DB(db,db.series.id,
'%(seriesname)s'))
db.product.finish.requires = IS_EMPTY_OR(IS_IN_DB(db,db.finish.id,'%(name)s'
))
db.product.cut.requires = IS_EMPTY_OR(IS_IN_DB(db,db.cut.id,'%(name)s'))
db.product.price.represent = lambda id,row: db.series(row.series).price





-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to