Bug 58468 - Not implemented function 'DAYS'
Summary: Not implemented function 'DAYS'
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.13-dev
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-29 18:20 UTC by Marek Matula
Modified: 2015-12-04 09:40 UTC (History)
0 users



Attachments
Test case + excel file (7.46 KB, application/zip)
2015-09-29 18:20 UTC, Marek Matula
Details
Days function implementation (3.74 KB, patch)
2015-12-04 09:40 UTC, Javen O'Neal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Matula 2015-09-29 18:20:46 UTC
Created attachment 33153 [details]
Test case + excel file

Evaluation of DAYS function fails with message:

org.apache.poi.ss.formula.FormulaParseException: Name '_xlfn.DAYS' is completely unknown in the current workbook
	at org.apache.poi.ss.formula.FormulaParser.function(FormulaParser.java:947)
	at org.apache.poi.ss.formula.FormulaParser.parseNonRange(FormulaParser.java:556)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:436)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:257)
	at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1143)
	at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1103)
	at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1090)
	at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1450)
	at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1570)
	at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1554)
	at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1511)
	at org.apache.poi.ss.formula.FormulaParser.intersectionExpression(FormulaParser.java:1492)
	at org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1472)
	at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1612)
	at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:153)
	at org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getFormulaTokens(XSSFEvaluationWorkbook.java:53)
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:261)
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:205)
	at org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:189)
	at org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.doEvaluateInCell(BaseXSSFFormulaEvaluator.java:133)
	at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:75)
	at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:34)
	at it.matula.expimp.DatesTest.evaluateFormula(DatesTest.java:104)
	at it.matula.expimp.DatesTest.getStringCellValue(DatesTest.java:88)
	at it.matula.expimp.DatesTest.getCellContent(DatesTest.java:67)
	at it.matula.expimp.DatesTest.testDays(DatesTest.java:42)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Comment 1 Javen O'Neal 2015-12-04 09:40:58 UTC
Created attachment 33323 [details]
Days function implementation

Official documentation:
https://support.office.com/en-us/article/DAYS-function-57740535-D549-4395-8728-0F07BFF0B9DF

Days(DateTime endDate, DateTime startDate) -> returns the number of fractional days from startDate to endDate.

I can't find the function code for DAYS in https://www.openoffice.org/sc/excelfileformat.pdf
Perhaps this function was developed after BIFF8, in which case it would only be available in XSSFWorkbooks.

The attached Days function is missing unit tests.