Issue 86643

Summary: ODFF: Make COUNT ignore error results
Product: Calc Reporter: ooo
Component: programmingAssignee: oc
Status: CLOSED FIXED QA Contact: issues@sc <issues>
Severity: Trivial    
Priority: P3 CC: issues, lvyue
Version: recent-trunkKeywords: ms_interoperability
Target Milestone: ---   
Hardware: All   
OS: All   
URL: http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 72764    
Attachments:
Description Flags
A patch
none
Another patch
none
patch3
none
patch4 of i86643
none
patch 5. Reset nGlobalError, and handle all errors. none

Description ooo 2008-03-03 13:22:47 UTC
To comply with the ODFF specification and for interoperability with other
spreadsheet applications, the COUNT function must ignore formula cells with
error results. The only types COUNT should count are numeric value, cell with
numeric content and formula cell with numeric result. Errors are not to be
propagated.
Comment 1 ooo 2008-03-03 14:11:51 UTC
Hi Yue!
This issue looks like a good next candidate for you to work on, I guess.
Thanks
  Eike
Comment 2 lvyue 2008-03-05 03:47:03 UTC
Created attachment 51891 [details]
A patch
Comment 3 ooo 2008-03-05 17:13:19 UTC
Hi Yue,

Almost.. for the case svSingleRef the patch unconditionally casts pCell to
ScFornulaCell* to call pFCell->GetErrCode(). That would be illegal if the cell
wasn't of type ScFormulaCell. Obtain the cell type first using
pCell->GetCellType() and check for CELLTYPE_FORMULA and only if so do the cast
and obtain the error code.

I also would not extract the ifCOUNT case from the switch to introduce another
if(eFunc==ifCOUNT) but handle the formula cell case inside the
switch(eFunc){case ifCOUNT}, decrementing nCount again in case it was a formula
cell with error result. That would save one comparison for all other functions
not being ifCOUNT. Might sound like nitpicking but ...  The error case is an
exceptional case, so generally nCount would only be incremented.

For the case svDoubleRef, as now ifCOUNT is handled explicitly in switch(eFunc),
the default case there can be removed, that only handled the then remaining
ifCOUNT case.

Thanks
  Eike
Comment 4 lvyue 2008-03-07 06:41:18 UTC
Created attachment 51960 [details]
Another patch
Comment 5 lvyue 2008-03-07 06:48:01 UTC
Created attachment 51961 [details]
patch3
Comment 6 lvyue 2008-03-07 06:50:23 UTC
Hi, Eike,
The patch2 is not complete, I forgot the part of CASE_OCERRFUNC macro.
So, please check patch3. :)


Thanks
  Yue
Comment 7 lvyue 2008-03-14 09:05:17 UTC
Created attachment 52093 [details]
patch4 of i86643
Comment 8 lvyue 2008-03-20 04:51:33 UTC
Created attachment 52225 [details]
patch 5. Reset nGlobalError, and handle all errors.
Comment 9 ooo 2008-04-10 19:03:14 UTC
In cws odff03:

sc/source/core/tool/interpr1.cxx  1.56.20.2
sc/source/core/tool/interpr4.cxx  1.55.20.1
Comment 10 ooo 2008-05-09 19:36:50 UTC
Reassigning to QA for verification.
Comment 11 oc 2008-06-09 13:28:45 UTC
verified in internal build cws_odff3
Comment 12 sgautier.ooo 2008-08-05 11:24:49 UTC
Verified under DEV300m28 under Linux - Closing - Sophie
Comment 13 jbf.faure 2008-08-05 11:43:13 UTC
Verified under Dev300_m28 under XP.
Comment 14 ooo 2009-01-29 11:51:37 UTC
*** Issue 51068 has been marked as a duplicate of this issue. ***