# how to change flow variable values over multiple rows

Hello
So in my workflow at some point I change column values to variables.
Later on down that workflow these values need to be replaced by other column values, how do I do that? (please note that the number of rows in the column can vary so I cant use math formula or column expressions as I don’t know how many rows need to be replaced each time the workflow is used)

Im not posting the workflow as its too large and confusing and this part that im stuck at is just a very little part in it. Please ask if you dont understand my problem
Thank you

Hi @lama12345 , unfortunately I don’t fully understand what the issue is…

You don’t have to share your whole workflow if it’s too big. You can just create a sample table with just 1 column and 3 lines, and explain what behaviour and results you want. That’s really what you are stuck with.

1 Like

@bruno29a
Okay I hope this workflow explains it further

This is my workflow

This is the table I created

This is the math formula node configuration

So we have 2 sets of column variables; Set A coming out of the table creator node and going into the loop start node, and Set B coming out of the math formula node and going into the loop end node. What id like to do is have the values of Set B replace the values of set A. The yellow box in the workflow screenshot is where I need to place a node to do this replacement. I can use multiple math formula nodes to replace each variable (1 variable for each row) however the number of rows (and thus number of variables) in the input table may differ everytime this workflow is used so this is not a practical solution.
I hope things are clearer now

Hi @lama12345 and thank you for the additional info.

Looking at the workflow, I’m not exactly sure what you are trying to accomplish. Is it just to do a +2 to all the values in the column? If that’s the case, you can simply apply the Math Formula on the table, and Knime will apply it to each row of the column automatically:

Input (same as yours):

Results:

Math Formula configuration:

And if you want these values as variable, you can convert the results into variables. So compared to what you did, instead of converting to variables and then trying to modify their values, you can do your manipulation/operation on the columns first, then convert to variables which is much easier.

Hello @bruno29a
I realize its very simple in this case, however, as I mentioned my actual workflow that im working on is very complicated and in it has multiple nested loops.
Replacing column variable values is something I need in that workflow and I dont have a simple alternative such as the one I have here.
So if you could tell me how to replace column variable values without fully being convinced with the logic that’d be great! I know its a bit confusing

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