Commit 5baa9371 authored by GoshaZotov's avatar GoshaZotov

add functions for DPRODUCT formula

parent ca07bf9c
......@@ -451,6 +451,40 @@
cDPRODUCT.prototype = Object.create(cBaseFunction.prototype);
cDPRODUCT.prototype.constructor = cDPRODUCT;
cDPRODUCT.prototype.argumentsMin = 3;
cDPRODUCT.prototype.argumentsMax = 3;
cDPRODUCT.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true, [cElementType.array, null, cElementType.array]);
var argClone = oArguments.args;
argClone[1] = argClone[1].tocString();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var resArr = getNeedValuesFromDataBase(argClone[0], argClone[1], argClone[2]);
if(cElementType.error === resArr.type){
return resArr;
}
var res = 0;
for(var i = 0; i < resArr.length; i++){
var val = parseFloat(resArr[i]);
if(!isNaN(val)){
if(0 === res){
res = val;
}else{
res *= val;
}
}
}
res = new cNumber(res);
return this.value = cElementType.error === res.type ? new cNumber(0) : res;
};
/**
* @constructor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment