Bug 60130 - [PATCH] DGET function, correct behavior with empty target cell
Summary: [PATCH] DGET function, correct behavior with empty target cell
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2016-09-14 09:08 UTC by Patrick Zimmermann
Modified: 2016-09-14 14:59 UTC (History)
0 users



Attachments
dget_empty_target_cell.patch (1.37 KB, patch)
2016-09-14 09:08 UTC, Patrick Zimmermann
Details | Diff
DGet.xls (52.50 KB, application/vnd.ms-excel)
2016-09-14 09:09 UTC, Patrick Zimmermann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Zimmermann 2016-09-14 09:08:48 UTC
Created attachment 34244 [details]
dget_empty_target_cell.patch

This patch fixes the return value of DGET when the target cell in the database is empty or the empty string (should return #VALUE!, previously returned 0).

I added several more tests to the DGet.xls file checking the behavior with different value types in the target cell.

Also added another test about the behavior of error values in the database header.
Comment 1 Patrick Zimmermann 2016-09-14 09:09:57 UTC
Created attachment 34245 [details]
DGet.xls

Should go to test-data/spreadsheet/DGet.xls
Comment 2 Nick Burch 2016-09-14 11:48:47 UTC
I've just tried applying your patch to trunk, and updating the DGet file. However, one of the unit tests then fails:

Testcase: processFunctionRow[strange types as headers - unused error header values] took 0.001 sec
   FAILED
In DGet.xls DGet!B100 {=DGET($G$92:$N$93,"Three",AH92:AI93)} 'strange types as headers - unused error header values'. Actual: ERROR
junit.framework.AssertionFailedError: In DGet.xls DGet!B100 {=DGET($G$92:$N$93,"Three",AH92:AI93)} 'strange types as headers - unused error header values'. Actual: ERROR
   at org.apache.poi.ss.formula.functions.BaseTestFunctionsFromSpreadsheet.processFunctionRow(BaseTestFunctionsFromSpreadsheet.java:166)

Any chance you could see what's going wrong and fix?
Comment 3 Nick Burch 2016-09-14 14:59:15 UTC
Patch applied in r1760717, thanks!