thank you so much for detail explanation, Anthony.
what i want to achieve is maximum number of allowed values same like total 
counted record that store in reference table
e.g.
count_test1 = db(db.test1.id > 0).count()

db.define_table('test0', 
Field('test1', 'list:reference test1'),
format = '%(test1)s')

db.test0.test1.requires = IS_IN_DB(db(), db.test1.id, db.test1._format, 
multiple = (1, count_test1) )

thanks and best regards,
stifan


On Wednesday, November 4, 2015 at 9:49:34 AM UTC+7, Anthony wrote:
>
> multiple = (1, db.test1.id)
>
> The second value of the tuple should be an integer representing the 
> maximum number of allowed values. It cannot be a Field object, and I'm not 
> sure what you are trying to achieve with that.
>
> Anthony
>
> On Tuesday, November 3, 2015 at 7:59:07 PM UTC-5, 黄祥 wrote:
>>
>> just confirmation :
>> is this right (the example : multiple = (1, x) ) ?
>> e.g. when try to use x in above example it return an error NameError: global 
>> name 'x' is not defined
>> db.define_table('test0', 
>> Field('test1', 'list:reference test1'),
>> format = '%(test1)s')
>>
>> db.test0.test1.requires = IS_IN_DB(db(), db.test1.id, db.test1._format, 
>> multiple = (1, db.test1.id) )
>>
>> thanks and best regards,
>> stifan
>>
>

-- 
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/d/optout.

Reply via email to