Discussion:
Validating the total value before write/delete
(too old to reply)
Johnny
2010-08-31 08:32:03 UTC
Permalink
I have a table X which contains several lines for each project. The sum of
all these lines makes the total project value.

Whenever any of the lines on X is updated or deleted the total project value
needs to be validated to make sure it is not bigger than a fixed amount. How
can I do this? I cannot figure out how to get the new value being written and
summing this up with the other values also available for the project.
unknown
2010-08-31 12:54:03 UTC
Permalink
You can overwrite the methods validateWrite and validateDelete on your table
X. From there you can do a select sum for one project and compare it with the
project line.

If you set "ret" to false, it will not update or delete the record since
you're failing the validation.
--
Mathieu Vaillancourt
http://vaillancourtm.blogspot.com
Post by Johnny
I have a table X which contains several lines for each project. The sum of
all these lines makes the total project value.
Whenever any of the lines on X is updated or deleted the total project value
needs to be validated to make sure it is not bigger than a fixed amount. How
can I do this? I cannot figure out how to get the new value being written and
summing this up with the other values also available for the project.
Loading...