Its a charm, thanks alot
On Saturday, October 20, 2018 at 11:32:23 AM UTC+2, sandeep patel wrote:
>
> There are many ways to solve this problem.
> you can achieve by computed fields.
>
> #modal
> db.define_table('logging',
> Field('startingDistanceValue','integer', requires=
> IS_NOT_EMPTY(),default=0),
> Field('endingDistanceValue','integer', requires=
> IS_NOT_EMPTY(),default=0),
> Field('distanceTravelled',compute=lambda r: r[
> 'startingDistanVealue'] * r['endingDistanceValue'])))
>
> Every time summited form distanceTravelled field calculated automatically.
>
> Best
> SP
>
> On Sat, Oct 20, 2018 at 2:46 PM mostwanted <[email protected]
> <javascript:>> wrote:
>
>> I was hoping to get assistance here, i have a database table called*
>> (logging)* that has 3 fields, *(startingDistanceValue,
>> endingDistanceValue and distanceTravelled)*, distanceTravelled is the
>> difference between endingDistanceValue and startingDistanceValue, when I
>> start my trip i enter startingDistanceValue & subit my form, when i arrive
>> i update & edit my form by entering endingDistanceValue, what i want is
>> that by entering endingDistanceValue then the distanceTravelled is
>> calculated automatically and acquires its value automatically then i submit
>> my form for saving. How can i achieve this in web2py?
>>
>> *Model:*
>> db.define_table('logging',
>> Field('startingDistanceValue','integer', requires=
>> IS_NOT_EMPTY()),
>> Field('endingDistanceValue','integer', requires=
>> IS_NOT_EMPTY()),
>> Field('distanceTravelled'))
>>
>> Regards:
>>
>> Mostwanted
>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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.