David B
06/15/2026, 12:50 AMid = 0 and transactionDiscount='T'
It's easy enough if we have:
line 1, item
line 2, posting discount-item
But I have examples of:
line 1, item
line 2, item
line 3, subtotal
line 4, posting discount-item
The logic is relatively straight forward, if the following line is a posting discount, that's it. If you run into a subtotal followed by a discount, then that's it.David B
06/15/2026, 12:52 AMIn contrast if you use a posting discount you have to explictly supply the dept, class, etc. segment. And then you have to use fancy SQL row windowing command to look back or look ahead 1 row in your reporting.