Math Formula subtraction from the last column by changing column number

Hi

I am still a beginner to Knime.

I want to use the "Math Formula"- node to subtract the first Column of my tabel from 
the last one.

The problem is that the number of columns is changing(depending on the days in a month). 

I already fund the Rowcount option in the Math Formula but I dont know how to use it to solve this problem.

What is the best way to do it?

Hi Suppe,

you can use a JavaSnippet for it, as it offers direct access to the columns by their index. Here is the code I used:

double firstColumn = getCell(0, tDouble);
double lastColumn = getCell(getColumnCount()-1, tDouble);
out_outcome = lastColumn - firstColumn;

 

However, if your last or first Column is not numeric, the code will produce missing values.

Best, Iris