I’m trying to write a script which will do some math on values from 3 columns and store it in a 4th column. I’ve got pretty much everything in place but fail at calculating the said expression - it always gives NaN as the result.

After some investigation, it turns out that the script fails to correctly read data obtained using the *valueForColumn* method.

Example:

var val = item.valueForColumn(col)

< undefined

val

< [object Decimal: 1]

var res = val * 5

< undefined

res

< NaN

Number(val)

< NaN

How do I obtain the numerical value correctly?