Sibylle Koczian wrote:
> Hello,
> 
> I try to do the following in my bizobj code, only for new records: 
> 
> Field A can be 0 or 1. If it is 0, the data should be saved as entered (this 
> works). If it is 1, then the value for field D should be calculated from the 
> values in B and C. This doesn't work.
> 
> If I put the code for checking field A and doing the necessary calculations 
> into onNew() or afterNew(), then it is executed before anything is entered in 
> the form. So field A has still its default value 0.
> 
> If I put it into onSaveNew(), then something curious happens: when I press 
> the "Save" button I get a message box with the question "Do you wish to save 
> your changes?" and when I press "Yes", then I get this error message:
> 

I don't think that you can use onSaveNew() for this because it's called
after the actual save to the db:
"""
onSaveNew(self)

Hook method called after successfully saving a new record.
""

Try to put it into the beforeSave() hook of your bizobj.

I often do this kind of work in the onHit of the forms save button.
Of cause it depends on where and how Form.save() gets called.

Did you think about using database triggers for this?
Sounds like a perfect case for an after insert trigger.

Uwe



_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to