Bug 60130

Summary: [PATCH] DGET function, correct behavior with empty target cell
Product: POI Reporter: Patrick Böker <patrick.boeker>
Component: SS CommonAssignee: POI Developers List <dev>
Severity: enhancement Keywords: PatchAvailable
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: dget_empty_target_cell.patch

Description Patrick Böker 2016-09-14 09:08:48 UTC
Created attachment 34244 [details]

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 Böker 2016-09-14 09:09:57 UTC
Created attachment 34245 [details]

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
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!