P
pkrikke
Guest
One other thing – I notice that you are using a “BREAK BY…” and later “LAST-OF()”. No problem with that – those work very nicely. However, you also have some “NEXT” statements in your code, and the combination of a LAST/LAST-OF/FIRST/FIRST-OF and NEXT statements can lead to subtle bugs. Simply put, in this case if you “NEXT” a record that is also a LAST-OF(), the last-of() block will never execute in that case. You may not care in this instance, but sooner or later you will. Trust me. J In case that isn’t clear, here’s a simple example where customer “12345” will never have totals displayed, because you’ll have skipped the record that was LAST-OF() for that customer. Customer Invoice# InvoiceType 12345 A111111 B 12345 A111112 C 12345 A111113 B 12345 A111114 B 12345 A111115 C 73541 A111116 C 73541 A111116 B 73541 A111116 B FOR EACH foobar NO-LOCK BREAK BY foobar.Customer: IF foobar.InvoiceType = “C” THEN NEXT. /*will skip invoice A111115 – which is last-of() for customer 12345*/ /*do some processing*/ IF LAST-OF(foobar.Customer) THEN DO: /*display totals or something*/ END. END.
Continue reading...
Continue reading...