@Cr223309 I don't have an example, but the basic idea would be to define a variable called previous_class right before the line items, sort the line items by class, then compare the current class with the previous_class variable. if they don't match, end the current table and start a new one. at the end of the loop, set previous_class to the current class.