Glad it worked. Out of curiosity, what prompted you to move from Pyramid to web2py for this app?
On Friday, January 13, 2012 10:59:43 PM UTC-5, Detectedstealth wrote: > > Thank you Anthony, > > That works exactly how I was want. I didn't even think to use > request.vars. Just trying to see how many different ways this is going to > save my team development time. > > We are moving youadworld.com from pyramid to web2py here is the start so > far if you are interested in watching the progress: http://176.34.12.39/ > > NOTE: There will be LOTS of changes and the database will be deleted and > rebuilt often over the next few months. youadworld.com however is live > and free to register to see what the current functionality is, and will be > in the new version with web2py. > > On Fri, Jan 13, 2012 at 2:47 PM, Anthony <[email protected]> wrote: > >> db.define_table('user_account'**, >>> .... >>> ) >>> db.define_table('distributors'**, >>> Field('account_id', db.user_account), >>> Field('uadpoints_balance_**available', 'integer', default=0), >>> ) >>> db.define_table('ads', >>> Field('member_id', db.user_account), >>> Field('points', 'integer', default=0), >>> ) >>> db.ads.points.requires = IS_INT_IN_RANGE(0, >>> db(db.distributors.account_id=**=db.ads.member_id).select()[0]** >>> .uadpoints_balance_available) >>> >> >> If 'ads' records will be added via form submission, then you might try: >> >> db.ads.points.requires = IS_INT_IN_RANGE(0, >> db(db.distributors.account_id=**=request.vars.member_id >> ).select().first()**.uadpoints_balance_available) >> >> You might want to set this in the form controller only when request.vars >> is not empty to avoid unnecessary db hits. >> >> Anthony >> >> > > > -- > -- > Regards, > Bruce Wade > http://ca.linkedin.com/in/brucelwade > http://www.wadecybertech.com > http://www.warplydesigned.com > http://www.fitnessfriendsfinder.com >

