Commit 7f7b3d82 authored by GoshaZotov's avatar GoshaZotov

changes for dmin function

parent c11b2f8a
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
var cBaseFunction = AscCommonExcel.cBaseFunction; var cBaseFunction = AscCommonExcel.cBaseFunction;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup; var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
var cElementType = AscCommonExcel.cElementType; var cElementType = AscCommonExcel.cElementType;
var cNumber = AscCommonExcel.cNumber;
cFormulaFunctionGroup['Database'] = cFormulaFunctionGroup['Database'] || []; cFormulaFunctionGroup['Database'] = cFormulaFunctionGroup['Database'] || [];
cFormulaFunctionGroup['Database'].push(cDAVERAGE, cDCOUNT, cDCOUNTA, cDGET, cDMAX, cDMIN, cDPRODUCT, cDSTDEV, cFormulaFunctionGroup['Database'].push(cDAVERAGE, cDCOUNT, cDCOUNTA, cDGET, cDMAX, cDMIN, cDPRODUCT, cDSTDEV,
...@@ -188,11 +189,19 @@ ...@@ -188,11 +189,19 @@
} }
var isTrueCondition = function(condition, val){ var isTrueCondition = function(condition, val){
return true; var res = false;
var condition = condition.getValue();
if("" === condition){
res = true;
}else{
res = window['AscCommonExcel'].matching(val, AscCommonExcel.matchingValue(condition));
}
return res;
}; };
var winElems = [];
var previousWinArray; var previousWinArray;
var winElems = [];
for(var i = 1; i < conditionBaseRowsCount; i++){ for(var i = 1; i < conditionBaseRowsCount; i++){
previousWinArray = null; previousWinArray = null;
for(var j = 0; j < conditionBaseColsCount; j++){ for(var j = 0; j < conditionBaseColsCount; j++){
...@@ -204,11 +213,11 @@ ...@@ -204,11 +213,11 @@
var winColumnArray = []; var winColumnArray = [];
for(var n = 0; n < databaseData.length; n++){ for(var n = 0; n < databaseData.length; n++){
if(previousWinArray && previousWinArray[0]){ if(previousWinArray && previousWinArray[n]){
if(isTrueCondition(condition, databaseData[n])){ if(isTrueCondition(condition, databaseData[n])){
winColumnArray[n] = true; winColumnArray[n] = true;
} }
}else if(isTrueCondition(condition, databaseData[n])){ }else if(!previousWinArray && isTrueCondition(condition, databaseData[n])){
winColumnArray[n] = true; winColumnArray[n] = true;
} }
} }
...@@ -216,6 +225,20 @@ ...@@ -216,6 +225,20 @@
} }
winElems[i - 1] = previousWinArray; winElems[i - 1] = previousWinArray;
} }
var needDataColumn = headersDataMap[field];
var resArr = [];
for(var i = 0; i < winElems.length; i++){
for(var j in winElems[i]){
resArr.push(needDataColumn[j].getValue());
}
}
resArr.sort(function(a, b) {
return a - b;
});
return this.value = new cNumber(resArr[0]);
}; };
......
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