Hi @rkehrli , you’re certainly on the right lines using the recursive loop for this.
I know your data is in a database, which is always a little more difficult to assist with her on the forum, but could you perhaps output a small sample of data to a file (with sensitive information removed) and upload here, along with an idea of your expected output for that sample data.
Typically with the recursive loop, you will keep iterative until you have exhausted the data, which I guess is what happens in your workflow when the joiner returns no further rows, so not knowing the number of levels should be fine.
@rkehrli , I have uploaded a demonstration of a method of processing a BOM structure using a recursive loop.
You will see at the top of this flow is an annotated set of nodes for creating the BOM structure and product list which are included in the flow. You can edit the Table Creator to modify the hierarchy if you wish to experiment, and then re-execute the upper flow to build the new csv files which will then be used in the lower flow.
In the lower flow, select the “Choose Item and Quantity” component and press F10 to open the view and choose the item to be “built”.
Just missed the editing window by a could of hours it seems.
This is a full, multi-level bill of materials from our database: Actual_BOM.xlsx (11.0 KB)
The reason why I’m trying to rebuild it in KNIME is because this BOM is actually built “on-demand” and there is no way to export it unless you do it by hand.
There is a “flat” BOM that gets generated once a day that is pretty much identical to the one I’ve made but we sometimes need an ad-hoc BOM if we have a new parent item or we need a multi-level one so we can do some calculations based on the parent items.
This is what my recursive loop is outputting: Example_BOM.xlsx (10.3 KB)
Note: the column IXKITL normally contains the parent item short number, I’m ommiting that in the joiner as I don’t need it in the export but it might be useful for the data handling.
Hi @rkehrli , assuming my understanding of your structure in Actual_BOM.xlsx is correct, the workflow can be adapted to iterate over your structure.
Actual-BOM
Workflow-BOM
Parent Item
Part ID
2nd Item Number
Component Part ID
Description
Component
Quantity
Quantity
In the workflow structure, I have also given the (repeated) description for the “Parent” in each case, and this can be derived by a self-join to transform your data into a form that will work with the workflow. (Annotated in the orange box)
With that done, the remainder of the workflow can work with minor modification - your part IDs are numeric, and so I have converted them when they are read to String (also annotated in Orange boxes)