I will assume you want the accumulated Quantity * Price
for your lines.
The easiest way is to store the line amount field on table redundantly and compute it in the modifiedField
method.
Then your total field could be a display method:
display Amount total()
{
return (select sum(LineAmount) from TableA where ...).LineAmount;
}
Other solutions are possible such as a computed view field, but this one is a simple no-brainer.
The standard table SalesLine
uses this approach as well albeit for other reasons.
That said even simple solutions come to short, if you have thousands of lines, in this case consider caching the total (on entry) then updating manually in write
and delete
methods.