I will try to pack a little app... Richard
On Fri, Jun 21, 2013 at 4:40 PM, Massimo Di Pierro < [email protected]> wrote: > It should. Can you provide a concrete example? > > > On Friday, 21 June 2013 10:31:45 UTC-5, Richard wrote: > >> Further code review lead me to the conclusion that the issue is not >> because compute don't get all it needs to compute... I mean I get the row >> and since it is a update every field are available in the row and I still >> need to redefine the compute field... >> >> Should computed field computes on db.table(id).update_record(**key=value, >> key=value, ...)? >> >> Thanks >> >> Richard >> >> >> On Thu, Jun 20, 2013 at 5:09 PM, Richard Vézina <[email protected]>wrote: >> >>> Ok, yes, it may not have some field that are to None... I had issue with >>> that that I have patch my compute function for. I should be the same... >>> >>> Thank you Massimo to point me this out. >>> >>> Richard >>> >>> >>> On Thu, Jun 20, 2013 at 5:02 PM, Massimo Di Pierro < >>> [email protected]> wrote: >>> >>>> I think the problem is that your form does not contain enough info for >>>> the computed field. You correctly pull them from DB (in row) and pass to >>>> the compute function. >>>> >>>> >>>> On Thursday, 20 June 2013 12:13:16 UTC-5, Richard wrote: >>>>> >>>>> Hello, >>>>> >>>>> I don't understand why I have to redefine my compute field function... >>>>> >>>>> I have a compute field like this one : >>>>> >>>>> # model >>>>> db.define_table('mytable', >>>>> Field('f1', 'string'), >>>>> Field('review', 'boolean'), >>>>> Field('record_review_status', compute=lambda record: >>>>> return_computed(record, request.args(0))) >>>>> >>>>> # contoller >>>>> def fun(): >>>>> form = SQLFORM.factory(Field(...)) >>>>> session.rows = db(db[request.args(0)].review == False).select() >>>>> table = SQLTABLE(session.rows...) >>>>> form.process().accepted: >>>>> for r in session.rows: >>>>> row = db[request.args(0)](r.id) >>>>> row.update_record(review='**TRUE**') >>>>> db.commit() >>>>> row = db[request.args(0)](r.id) >>>>> *row.record_review_status = return_record_review_status(row, >>>>> request.args(0)) # here I need to redefine my record_review_status compute >>>>> field or it not get computed* >>>>> row.update_record() >>>>> db.commit() >>>>> ... >>>>> >>>>> Note : It is pseudo code, so it may seems dumb or not working, I just >>>>> try to make an example of what going on in my app... >>>>> >>>>> In the book it is said that if we try to update record without >>>>> passing, web2py tries to compute compute field base on orther field >>>>> value... >>>>> >>>>> http://web2py.com/books/**defaul**t/chapter/29/06?search=**compute** >>>>> #Computed-fields<http://web2py.com/books/default/chapter/29/06?search=compute#Computed-fields> >>>>> >>>>> By the way, this part of the book is not pretty clear... For instance >>>>> do I have to leave update() of update_record() blank in order to get my >>>>> compute field to be computed. >>>>> >>>>> Also, it is not exactly clear to me why my compute field not get >>>>> compute on row.update_record(review='**TRUE**')... What I understand >>>>> is that I need to explicitly update my compute field, but the way to do it >>>>> seems to passing not paramaters to update() or update_record(). >>>>> >>>>> In my case, it seems that my compute function can't get the 'TRUE' for >>>>> review only once the update(review='TRUE') is committed... I try to remove >>>>> the line in bold, because it already in my model, but it is not working, >>>>> my >>>>> compute field never get updated it status. >>>>> >>>>> Thanks to clarify this to me. >>>>> >>>>> Richard >>>>> >>>> -- >>>> >>>> --- >>>> 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+un...@**googlegroups.com. >>>> >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>> >>> >> -- > > --- > 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/groups/opt_out. > > > -- --- 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/groups/opt_out.

