Bug 35290 - FormulaRecord getValue & setValue enhancement
Summary: FormulaRecord getValue & setValue enhancement
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: Other other
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2005-06-09 17:16 UTC by Amol Deshmukh
Modified: 2008-07-10 16:10 UTC (History)
1 user (show)

[PATCH] Enhancements to FormulaRecord for reading calculated value of formula (17.71 KB, patch)
2005-06-09 18:37 UTC, Amol Deshmukh
Details | Diff
Updates to FormulaRecord and FormulaRecordAggregate (26.19 KB, patch)
2005-06-14 00:06 UTC, Amol Deshmukh
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amol Deshmukh 2005-06-09 17:16:30 UTC
FormulaRecord stores additional info along with formula expression that includes
the result of formula evaluation. however only numeric values are currently
parsed by FormulaRecord (String, boolean, blank, error are treated as unknown)
Comment 1 Amol Deshmukh 2005-06-09 18:37:02 UTC
Created attachment 15355 [details]
[PATCH] Enhancements to FormulaRecord for reading calculated value of formula

Prior to this Patch, FormulaRecord ignored non numeric values (treated them as
UNKNOWN). This patch modifies FormulaRecord so that it correctly identifies the
type of the value and stores it. Testcases have been included in patch.

Results were verified by running BiffView (since FormulaRecord.toString() has
also been modified accordingly).
Comment 2 Amol Deshmukh 2005-06-14 00:06:48 UTC
Created attachment 15394 [details]
Updates to FormulaRecord and FormulaRecordAggregate

Thanks to Avik for pointing out that String value of formula evaluation is
stored in an external StringRecord in FormulaRecordAggregate. Accordingly, this
patch improves over the previous patch by:
1. removing getStringValue from FormulaRecord
2. enhancing FormulaRecordAggregate api by adding the foll functions:
   public double getNumberValue()
   public boolean getBooleanValue()
   public byte getErrorCodeValue()

   public byte getValueType() 

   public void setValue(double value) 
   public void setValue(String value) 
   public void setValue(boolean value) 
   public void setValue(byte errorCode)
3. JUnit Tests for FormulaRecordAggregate have been added
Comment 3 Trejkaz (pen name) 2006-01-20 00:28:00 UTC
This looks useful... even more useful if HSSFCell is patched to take advantage
of it.
Comment 4 Jason Height 2006-01-20 03:22:56 UTC
Ill look into it.

We are making some reasonably major changes on the trunk at the moment, i see no
reason why this cant be applied.

Comment 5 Nick Burch 2008-07-10 16:10:37 UTC
I believe something like this has been applied to svn trunk. You can now get at the cached values of formula cells of all types