Commit a7e81298 authored by GoshaZotov's avatar GoshaZotov

add function for DCOUNTA formula

parent a3693081
......@@ -277,12 +277,10 @@
return resArr;
}
var summ = 0;
var count = 0;
for(var i = 0; i < resArr.length; i++){
var val = parseFloat(resArr[i]);
if(!isNaN(val)){
summ += val;
count++;
}
}
......@@ -301,6 +299,34 @@
cDCOUNTA.prototype = Object.create(cBaseFunction.prototype);
cDCOUNTA.prototype.constructor = cDCOUNTA;
cDCOUNTA.prototype.argumentsMin = 3;
cDCOUNTA.prototype.argumentsMax = 3;
cDCOUNTA.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], true);
if(cElementType.error === resArr.type){
return resArr;
}
var count = 0;
for(var i = 0; i < resArr.length; i++){
if(cElementType.empty !== resArr[i].type){
count++;
}
}
return this.value = new cNumber(count);
};
/**
* @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