I would like to create a table with a predefined number of rows (say, 500) , and then fill it with the numbers 1 through 500. I can imagine this could be done with some simple Java code, but unfortunately I can't code...
Any other solutions highly appreciated!
the simplest way would be to use a Java Snippet (simple) node, but since you would like to do it without programming, there is another way which uses a Time Series Generator node. See the attached workflow.
Another option, also without programming, would be to use a recursive loop and a flow variable to keep track of the sequantial number to fill into the next row, but the solution employing the Time Series Generator node is definitely much simpler to understand and maintain.
this can be done with the KNIME Data Generation nodes (https://www.knime.org/datagen)
You need first an Empty Table Generator (configured with 500) and than the Counter node and your done.
No Java needed :-)
Indeed, that's much simpler, had fogotten about the Counter Generation node!
Thanks Iris. :-)
Brilliant solution, as always ;-)
Now I actually would like to control the number of rows generated by the Empty Table Generator by a variable (a number that comes from another node). But the variable settings for the Number parameter are greyed out.
Attached a picture of the workflow and the messages. What I'm trying to achieve is to find missing values in a number of Compound IDs stored in a mySQL database. The numbers have the form TH000001, TH000002 etc. I split these to get the numeric parts and then determine the highest number in the database, and then reference the numeric TH list against a complete sequence of numbers in order to identify the missing TH numbers. So I want to use the max TH number as a variable to set the number of rows to be generated by the Empty Table Generator.
I hope you understand what I want to achieve - there may be a simpler solution even?
you can control the number of rows generated by the Empty Table Generator node with a workflow variable, but the variable needs to be created before that node runs and has to be passed to it via its workflow variable input port. Here is how it should look like. The Max Rows variable contains the maximum number from your TH table.