Work with dynamic column names in Java snippet and math formula

The column headers from the input excel files changes every quarter. For example this quarter they will be 'Q1 2014','Q2 2014',Q3 2014'... And next quarter they will be 'Q2 2014', 'Q3 2014'... And I need knime to read data from each column and do some calculation and comparison. How can I make Java Snippet and math formula to refer to these columns without manually select the column names every quarter?

Can I pass these column names to an variable array? I tried extract column name , transpose and tablerow to variable node. It only took one column name not all. Please help me solve this.

Thank you very much.

If they are always in the same place, then you can refer to them in the Java snippet by their column index number - I think the templates tab has an example of doing this.

Otherwise, you might be able to use flow variables to point to the actual column names that are referred to in the columns selections part of the java snippet (the bit below the actual snippet code, where the incoming and outgoing columns are listed) - so setup your snippet to operate something like

c_newResult = c_incomingColumn.doWhateverNeeded();

where c_newResults and c_incomingColumn (whatever you choose to call them) are defined at the bottom of the snippet configuration, and then configure the value in the actual column selection dropdown using flow variables


Also, something I often do in this case is use the extract/insert column header nodes to normalize the column names and then restore them after I have done my processing.

Thank you. Your suggesting of refering to column index worked great!

But then I found that I need to use the column names later when appending a new column. The new column name should be old column name+"Risks". 

So How should I resolve that? Thank you.

Thank you. Please let me know how to normalize column names and restore them later. I also need to use the column names to in the new appended columns. Don't know how to do that. Please help. Thanks.

Here is an example workflow that shows the node motif that I am talking about.  

and an image for quicker viewing

Great example. Wokrs like a charm! Thank you very much!