On Friday, June 30, 2017 at 11:45:37 AM UTC-4, Ramos wrote:
>
> Another problem or symptom is that the computed function need the record
> update call to pass all the fields the computed function needs to access
> otherwise does not execute.
>
> for example
>
> my record with id =1
> {"event":"1","created_by":4,"status":21}
>
> this line
> db(db.entities.id==1).update(event="2",status=21)
> is different from this line
> db(db.entities.id==1).update(event="2",status=21*,created_by=2*2)
> because passing created_by it allows the computed field to use it if it
> needs it.It does not receive the full record fields.
>
> Is this correct or am i missing something?
>
Yes, that's how it works. The .update() method sends an update query to the
database -- it does not first select the records from the database (which
would be inefficient), so it has no access to the current records. If you
need the current values of some of the fields for the computed field to be
calculated, then you must first select the records yourself.
Anthony
--
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.