- Code: Select all
//oDataset is a dataset created by a recent query
var aNumbers = oDataset.getColumnAsArray(1); //Column 1 is a column of numbers;
var nMin = Math.min.apply(Math, aNumbers);
This will throw the following exception
TypeError: second argument to Function.prototype.apply must be an array
However, if you concatenate the result of getColumnAsArray to an empty array
- Code: Select all
//oDataset is a dataset created by a recent query
var aNumbers = [].concat(oDataset.getColumnAsArray(1)); //Column 1 is a column of numbers;
var nMin = Math.min.apply(Math, aNumbers);
What's going on here? getColumnAsArray doesn't really return an array, just an array-like-object?
Servoy Version: 5.2.14 - build 1027