A customer wanted a delivery analysis, which meant for them: what's the delivery % on the first delivery created for an order. In other words how complete is the first delivery for an order. This gave me a challenge, because I can easily find out if an orderline is delivered or not, but it was not that easy finding out if it was delivered with the first delivery.
For this I created a join where I searched for all DLN1 lines per order (no matter if it was the first or second one). To be able to do this I created a join between docentry of the order and base entry for the DLN1. I didn't join the baseline as you would normally do.
I created an aggregate on the docentry of the DLN1, where I wanted the minumum number of the docentry (which is always the first delivery, as the docentry is an internal numbering). After this, the result was I had the order and the First delivery of that order. Later on I could join this delivery in combination with the linenumber of the order, in order to find out if the line of the order was delivered in the first delivery.