Hi … I use the Lag Column node to create a variable number of columns from an input column that is a boolean 1 or 0. In this example, the lag is 6, but it is based on a variable that adds complexity later in the solution.
With a limited fixed number of columns, as in this example, I can do it with rule engine nodes but it does not work at all when the number of columns is variable (which it needs to be).
@TigerCole could you use the Math Formula (Multi Column) – KNIME Hub on your flexible number of integer columns? Maybe you could provide us with a sample file that would cover the whole of your challenge.
Can you please confirm your expected output? In your post here, you have the value * the nth column yet in your uploaded workflow you have it reversed.
I have something dynamic right now based on the table dimensions of the numbered columns but it might need some minor adjustment due to the beforementioned discrepancy.
Sorry that I created the confusion … the workflow is correct. I realized after I published the topic that the inactivity penalty was increasing as it got older but it should decrease as it ages.
Key point is the enforced exclusion/inclusion of certain columns. For example, to determine the amount of numbered columns to deal with which can be initiated with a column filter on type integer.
With a Table Dimension node I then know that the script needs to handle 7 columns. This will be of use later on.
For the actual processing of the rows, I opt for a Column List loop with only the numbered columns being in scope (controlled by a Column Splitter node in front). This will ensure the proper processing of the dynamic part in terms of the amount of numbered columns and also limit the amount of data that has to pass through the loop.
What’s helpful about this loop that it automatically keeps track of the column name and iteration as a flow variable.
My apologies for taking so long to reply. Thank you for your help to resolve this problem. I have a working solution that is really efficient and very robust with any number of columns.