Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
122e1e5c
Commit
122e1e5c
authored
Jun 07, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add IFNA formula
parent
729ef67c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
15 deletions
+48
-15
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+8
-0
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+0
-14
cell/model/FormulaObjects/logicalFunctions.js
cell/model/FormulaObjects/logicalFunctions.js
+40
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
122e1e5c
...
...
@@ -4312,6 +4312,14 @@ $( function () {
}
);
test
(
"
Test:
\"
IFNA
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
IFNA(MATCH(30,B1:B5,0),"Not found")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
(),
'
IFNA(MATCH(30,B1:B5,0),"Not found")
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
Not found
"
,
'
IFNA(MATCH(30,B1:B5,0),"Not found")
'
);
}
);
test
(
"
Test:
\"
XNPV
\"
"
,
function
()
{
function
xnpv
(
rate
,
valueArray
,
dateArray
){
...
...
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
122e1e5c
...
...
@@ -73,8 +73,6 @@
cFormulaFunctionGroup
[
'
LookupAndReference
'
].
push
(
cFORMULATEXT
);
cFormulaFunctionGroup
[
'
Information
'
]
=
cFormulaFunctionGroup
[
'
Information
'
]
||
[];
cFormulaFunctionGroup
[
'
Information
'
].
push
(
cISFORMULA
,
cSHEET
,
cSHEETS
);
cFormulaFunctionGroup
[
'
Logical
'
]
=
cFormulaFunctionGroup
[
'
Logical
'
]
||
[];
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cIFNA
);
/**
* @constructor
...
...
@@ -604,18 +602,6 @@
cHYPGEOM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cHYPGEOM_DIST
.
prototype
.
constructor
=
cHYPGEOM_DIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cIFNA
()
{
cBaseFunction
.
call
(
this
,
"
IFNA
"
);
this
.
isXLFN
=
true
;
}
cIFNA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIFNA
.
prototype
.
constructor
=
cIFNA
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/logicalFunctions.js
View file @
122e1e5c
...
...
@@ -50,7 +50,7 @@
var
cFormulaFunctionGroup
=
AscCommonExcel
.
cFormulaFunctionGroup
;
cFormulaFunctionGroup
[
'
Logical
'
]
=
cFormulaFunctionGroup
[
'
Logical
'
]
||
[];
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cAND
,
cFALSE
,
cIF
,
cIFERROR
,
cNOT
,
cOR
,
cTRUE
,
cXOR
);
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cAND
,
cFALSE
,
cIF
,
cIFERROR
,
c
IFNA
,
c
NOT
,
cOR
,
cTRUE
,
cXOR
);
/**
* @constructor
...
...
@@ -237,6 +237,45 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cIFNA
()
{
this
.
name
=
"
IFNA
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cIFNA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIFNA
.
prototype
.
constructor
=
cIFNA
;
cIFNA
.
prototype
.
argumentsMin
=
2
;
cIFNA
.
prototype
.
argumentsMax
=
2
;
cIFNA
.
prototype
.
isXLFN
=
true
;
cIFNA
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
if
(
arg0
instanceof
cArray
)
{
arg0
=
arg0
.
getElement
(
0
);
}
if
(
arg0
instanceof
AscCommonExcel
.
cRef
||
arg0
instanceof
AscCommonExcel
.
cRef3D
)
{
arg0
=
arg0
.
getValue
();
}
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
cross
(
arguments
[
1
]);
}
if
(
arg0
instanceof
cError
&&
cErrorType
.
not_available
===
arg0
.
errorType
)
{
return
this
.
value
=
arg
[
1
]
instanceof
cArray
?
arg
[
1
].
getElement
(
0
)
:
arg
[
1
];
}
else
{
return
this
.
value
=
arg
[
0
];
}
};
cIFNA
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(value, value_if_na)
"
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment