AnsweredAssumed Answered

Embed If in a loop

Question asked by clayhendrix on Oct 19, 2016
Latest reply on Oct 20, 2016 by philmodjunk

I have a simple script that creates invoices for student tuition. Some students have a line item for tuition and a line item for the after school program. The first student (as the sort would have it) is for a student that only has a tuition line on the invoice, the invoice is created properly, and the script advances to the next student and creates an invoice. However, the second student DOES have an after school program, it is added properly to the invoice, BUT the script continues to create invoices for that same (the second student) over and over until I stop the script. The first invoice is correct, the second invoice is correct, and then all of the other invoices created are replicas of the second one (except the invoice number advances).

 

It appears that when the student does have the after school program item to be billed, then the script does NOT advance to the next student.

 

Below is the script in two versions. One with an Else If (I was trying) and one without Else If. Both result exactly (as far as I can tell) as I have described above.

 

Please help if you can.

Outcomes