Hi Derek... you are right ... this is it.. works as designed:
Just modified the definition for the MATERIALS; added "format...":
db.define_table("MATERIALS",
Field <http://127.0.0.1:8000/examples/global/vars/Field>("MATNR",
"string", length=18, notnull=True, default=None),
Field <http://127.0.0.1:8000/examples/global/vars/Field>("MAKTX",
"string", length=30, notnull=True, default=None),
Field <http://127.0.0.1:8000/examples/global/vars/Field>("MEINS",
"string", length=5, notnull=True, default=None),
Field <http://127.0.0.1:8000/examples/global/vars/Field>("WERKS",
"string", length=5, notnull=True, default=None*), format='%(MATNR)s')*
Thanks a lot
Beat
Am Mittwoch, 30. April 2014 20:02:08 UTC+2 schrieb Derek:
>
> According to the documentation, you can't. Have you tried using a
> 'represent' on the 'materials' table to show the matnr instead of the id?
>
> On Wednesday, April 30, 2014 7:47:30 AM UTC-7, Beat Kohler wrote:
>>
>> I am on the way to develop a small purchase requisition application.
>> The main idea is: the user select from a list of materials a material
>> number and enter the quantity.
>> Finally he will confirm his requisition and send it to a external system.
>> To create the purchase requisitions I use a simple smartgrid.
>> My problem is now that in the requisition table instead of the material
>> number only the id of the related table is stored.
>> Here my definitions:
>> *db.py*
>> *- Materials*
>> db.define_table("MATERIALS",
>> Field("MATNR", "string", length=18, notnull=True,
>> default=None),........ and more
>> *- Purchase requistions*
>> db.define_table("BANFTEMP",
>> Field("Pippo", db.auth_user, default=auth.user_id, writable=False,
>> update=auth.user_id),
>> * Field("MATNR_MATERIALS", db.MATERIALS, default=db.MATERIALS.MATNR,
>> update=db.MATERIALS.MATNR)*, ..... and more
>> ......
>> db.BANFTEMP.MATNR_MATERIALS.requires=IS_IN_DB(db, db.MATERIALS.id,
>> '%(MATNR)s')
>>
>> *default.py*
>> grid = SQLFORM.grid(db.BANFTEMP)
>>
>> How I can convince WEB2PY to store the MATNR and not the id in
>> BANFTEMP.MATNR_MATERIALS ??
>> Any help is welcome an a free beer offered (if you stay in Switzerland
>> :-) )
>> Beat
>>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.