> > I cannot use web2py id's for referencing my brands, I need to use id's > from another CRM application called "01". So I have in my "brands" table a > field called "id_01" and in the "products" table a field called > "brand_id_01". >
> db.define_table('brands', > Field('id_01', unique = True), > Field('name'), > format='%(names') > Does the "brands" table in the CRM application have an auto-incrementing integer field called "id"? If not, then the above table definition is incorrect. If "id_01" is an auto-incrementing integer field, then you should do: db.define_table('brands', Field('id_01', 'id'), ...) In that case, your reference field in db.products should work fine (you don't even need to bother defining the IS_IN_DB validator). If "id_01" is not an integer field, then you should do: db.define_table('brands', Field('id_01', unique=True), ..., primarykey=['id_01']) In that case, though, you will only be able to reference db.brands from other keyed tables (see http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Legacy-databases-and-keyed-tables ). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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.