Using
var minWT = Math.min(ci_wt_clock_position1, ci_wt_clock_position2, ci_wt_clock_position3)
I get my expected result - a number. The columns are recognised as being numbers. However, there are 12 of these columns to consider and some of them may be 0 or empty so I need to qualify them before use. With the following code I make sure there is a usable number in the column, and if so add the column to vPositions.
var vPositions = ‘’
if (ci_wt_clock_position1 !=0 && ci_wt_clock_position1 !=null){ vPositions = ci_wt_clock_position1;}
if (ci_wt_clock_position2 !=0 && ci_wt_clock_position2 !=null){ vPositions = vPositions + ', '+ ci_wt_clock_position2;}
if (ci_wt_clock_position3 !=0 && ci_wt_clock_position3 !=null){ vPositions = vPositions + ', '+ ci_wt_clock_position3;}
application.output(vPositions) //I get the list of column values as expected
However if I feed that var to - var minWT = Math.min(vPositions) I get NaN as a result. I suppose its taking the column values as a string rather than a list of values. I also tried this as an array but minWT always comes out as NaN!
Q. Can I get the ‘Math.min’ to take this variable as a list of comma separated values (just as it does with Math.min(ci_wt_clock_position1, ci_wt_clock_position2, ci_wt_clock_position3) )?
Appreciate feedback.