Dear Oliver,
The way you depicted is one of the two popular methods to achieve the goal you want. In this way, you fill a value table via a query to which you pass an invoice as a parameter. As a result, the query returns all the items for the value table at once.
Another way to achieve the same goal is to populate a dynamic list to which you pass an invoice as a filter parameter. The benefit of using dynamic lists is that every time you apply the filter, you can get the desired number of items rather than all the items at once.
Best regards,
Vladimir Gurov