Legacy Column Expression Node to new Expression Node

Good Morning

I have a Legacy Column Expression Node that I need to replace. I have tried, and failed, to move the work from one to the other. I think this is because I can not dynamically chose to replace a column (or I cant figure out how). I can not give you a work flow as it is part of a flow I use for work.

What the node does:

The node sits inside a loop that iterates through the columns of a table. These columns are dynamic and will change.

‘Column 0’ is the name of the column I am checking. ‘column expression’ is a bool - normally true.

Any help or advice on this would be great, thank you

Frank

@FrankColumbo one way to deal with dynamic column names in loops is to rename the column to a standard. Do the operations and rename it back. Not the most elegant solution but anyway.

Otherwise, I would need to think about the use case some more.

3 Likes

Thank you for your suggestion. It gives me a starting point.

In a way, I am pleased, that no-one could use the new Expression Node - it means I wasnt being thick.

Frank

1 Like

@FrankColumbo you can also use the New Expressions node for this in the same way. Indeed, it would be good if there was an option to use column names as variables.

You could do this with the Legacy node though

1 Like

works the same with the new Expression node (this is Knime 5.4.4)

@fe145f9fb2a1f6b the problem is to address the column name within the code and then replace the same column name. If you can find a way I would be interested.

ah ye, nevermind didnt catch that.

afaik Expression node never received that functionality (yet another shortfall this incomplete node…)

only viable option I know is using the column index (e.g. sort all columns that you want to adjust to the front and column list loop modify index 0. alternatively, rename the column and rename it back within the column list loop. third option, also within the loop, to split the columns, and append them again in a way that you also have the current column at index 0)

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