'One Row to Many' doesn't accept a variable override

Is there another way to create multiple rows based on a variable input?

Hi there @George_Nicola,

you are right. One Row to Many takes value from column. There are workaround but can you tell me a bit more about your use case so I can make better suggestion? Do you need to multiply each row with same number?

Br,
Ivan

1 Like

Hi @George_Nicola and welcome back to the KNIME forum,

The One Row to Many node accepts flow variables to override it’s configurations. So you can override the column name using a flow variable.

But if you want to use an integer flow variable to multiply rows, you can use the SMOTE node after adding a column with all unique values (e.g. adding current row IDs by using the RowID node). Then select the unique value column as the class column in the configuration window of the SMOTE node and assign the flow variable to the “rate” option in the Flow Variables tab.

:blush:

1 Like

Hi @ipazin, I was trying to append the same row to a table a certain number of times, based on variable input table sizes as part of a loop. I found a workaround, by using multiple Constant Value Column nodes, but it’s not as elegant.

Hi @armingrudd, the One Row to Many node provides variable overrides only for column and input names, but not for number of times to repeat the row, which is what I need.
Thanks for your SMOTE suggestion; that seems to be another functional workaround.

2 Likes

Hi @George_Nicola,

hmmm…unfortunately still don’t get it. Why multiple Constant Value Column nodes? Willing to share example? Asking cause thinking of some improvement for this node…

Br,
Ivan

@ipazin, I have a row consisting of 5 columns that needs to be repeated X number of times. The Constant Value Column node only does this for one column at a time. So I needed to attach 5 of these in sequence. One idea for node improvement is to allow for batch append multiple columns, each of which can be overridden with a variable input.

Hi @George_Nicola,

still don’t get it. Sry. Any example with data?

Here is wf example where rows are multiplied using one Constan value Column which is controlled by flow variable created with Integer Configuration node. Were you looking for something like this?

2020_02_17_RowMultiplication.knwf (14.7 KB)

Br,
Ivan

1 Like

Ah, that did the trick; Thanks!

1 Like

Hi @George_Nicola,

glad to finally hear that :smiley:

Br,
Ivan

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.