Total when deleting subform row
I have a subform which contain a field 'SubAmount' ,which gets summed to 'Amount' in the main form.
Is there a way for the parent form 'Amount' total to update after a sub form row has been removed, but before the main form has been submitted?
I've tried this "On Delete Row", but it doesn't seem to be working.
- delete from Washpack_SubAmount[ ID == row.ID ];
- grandTotal = 0.0;
- for each item in SubAmount
- {
- if (item.SubAmount != null)
- {
- grandTotal = (grandTotal + item.SubAmount);
- }
- }
- input.Amount = grandTotal;