On Friday, September 16, 2011 2:54:24 AM UTC-4, annet wrote:
>
> This is what I got so far, 
>
> row=db(db.function.bedrijf_id==id).select().first() 
>     form=crud.update(table=db.functions,record=row) 
>     crud.settings.update_onaccept = StorageList()
>

update_onaccept=StorageList() won't do anything by itself -- that just 
enables you to specify a dictionary of lists of update_onaccept functions 
(different lists of functions for different tables). So, because the table 
name is 'function', you'd do 
crud.settings.update_onaccept.function.append(lambda form: ...). But if you 
want to add the counter value to the form variables before the database 
record is updated, then you'd probably want to use 
crud.settings.update_onvalidation, which runs after validation but before DB 
update. Even better, though, why not use a computed field:

    Field('counter',type='integer',compute=count_functions)

def count_functions(row):
    return sum(row.values()[1:9])
 
Anthony

Reply via email to