I’d like to learn a general method for creating table rows, inside a loop. I created a simple loop:
- Originates with a table created via “Table Creator” node.
- Enters the loop, with “Counting Loop Start” and “Loop End” nodes bounding the loop.
- Inside the loop, has one node: “Add Empty Rows”, set to add 1 additional row
I’m wondering why the result of running the loop (1000 times) only results in ONE additional row created, rather than 1,000?
I tried making a simple workflow based on your approach and came up with this. There’s a clunky Rule-based Row Filter node at the end, but it works. Maybe you can come up with something better?
TableRowAppendLoopExample.knwf (13.2 KB)
Perfect; thanks SO much!!!
Now I need to look back at my original workflow, and see what I did wrong…
OK, the difference was that I didn’t have a node after the “Loop End”. When I placed a node (“Rule-based Row Filter”) after the “Loop End” node, my original workflow worked too.
I had “ass-u-med” that after running, with no node after the “Loop End”, I could look at the result of the “Add Empty Rows” node, and see all the rows. I don’t really understand why I can only see the result in a node after “Loop End”, but I can accept that I’m still (very) new to KNIME, and that is just how KNIME works!
You can use Cross Joiner for this task instead of a loop. The said node will produce a Cartesian product between two tables.
The question is of course why you don’t simply use the Add Empty Rows node controlled manually or via a flow variable.