0
Loop error / syntax
Hi all, this piece of code is adding summing up multiple times:
let me := this;
for i in select Pupil do
let myInvoice := (create Invoice);
myInvoice.(InvoiceDate := now());
myInvoice.('Invoice Amount' := sum((select Pupil).i.'Pupil Attendance Detail'.'StuChg £'));
myInvoice.(Pupil := i.Id)
end
for example, if I have 5 students, it sums up all of the values 5 times, it's probably an easy solve but it's not jumping out at me.
Thanks in advance
2 replies
-
Try this for the sum...
myInvoice.('Invoice Amount' := sum(i.'Pupil Attendance Detail'.'StuChg £');
The pupil table is already selected by the for-loop.
-
Perfect - thank you so much!
Content aside
- 4 yrs agoLast active
- 2Replies
- 850Views