I am afraid you are in for a CTE. I am certainly not the person to help with that. Me and CTEs don’t get along for some reason. I think that is the only way to create the kind of nested structure you need. I Still Don’t Understand CTEs - Kinetic ERP - Epicor User Help Forum