[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread greenpoise
it worked w quotes on..couldnt tell you which is right though On Friday, September 6, 2013 10:03:40 AM UTC-7, Anthony wrote: Probably should remove the quotes from the 2, no? On Friday, September 6, 2013 12:59:36 PM UTC-4, greenpoise wrote: Ended up using lambda instead.

[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread Anthony
I suppose it gets converted to an integer upon insert, but you might as well just start with an integer. Anthony On Friday, September 6, 2013 1:32:32 PM UTC-4, greenpoise wrote: it worked w quotes on..couldnt tell you which is right though On Friday, September 6, 2013 10:03:40 AM

[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread greenpoise
since is a reference, shouldnt it be an integer? hmm..a bit confused..my data looks fine for now On Friday, September 6, 2013 10:36:03 AM UTC-7, Anthony wrote: I suppose it gets converted to an integer upon insert, but you might as well just start with an integer. Anthony On Friday,

[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread greenpoise
Ended up using lambda instead. Field('conversiontype','reference conversiontype',compute=lambda r: 1 ifrequest .vars.tileuse == '5' else '2'), Thanks! On Thursday, September 5, 2013 7:25:32 PM UTC-7, greenpoise wrote: Thats exactly what I am looking! Thanks, will try and post Thanks

[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread Anthony
Probably should remove the quotes from the 2, no? On Friday, September 6, 2013 12:59:36 PM UTC-4, greenpoise wrote: Ended up using lambda instead. Field('conversiontype','reference conversiontype',compute=lambda r: 1 ifrequest .vars.tileuse == '5' else '2'), Thanks! On Thursday,

[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread Anthony
On Friday, September 6, 2013 2:13:44 PM UTC-4, greenpoise wrote: since is a reference, shouldnt it be an integer? hmm..a bit confused..my data looks fine for now Yes, but you have it as a string (i.e., '2' instead of just 2). I was just suggesting: compute=lambda r: 1 if

[web2py] Re: Field value based on other field in Dal?

2013-09-06 Thread greenpoise
Worked! thanks!! On Friday, September 6, 2013 12:07:49 PM UTC-7, Anthony wrote: On Friday, September 6, 2013 2:13:44 PM UTC-4, greenpoise wrote: since is a reference, shouldnt it be an integer? hmm..a bit confused..my data looks fine for now Yes, but you have it as a string (i.e.,

[web2py] Re: Field value based on other field in Dal?

2013-09-05 Thread Anthony
Does conversiontype need to be writable in forms? If not, you can use a computed field. If you are just trying to change the default value, you could do something like: Field('conversiontype','reference conversiontype', default=5 if request.vars.tiluse == 5 else 2) Note, that will only

[web2py] Re: Field value based on other field in Dal?

2013-09-05 Thread greenpoise
Thats exactly what I am looking! Thanks, will try and post Thanks Anthony On Thursday, September 5, 2013 6:31:46 PM UTC-7, Anthony wrote: Does conversiontype need to be writable in forms? If not, you can use a computed field. If you are just trying to change the default value, you could