Issue 86643 - ODFF: Make COUNT ignore error results
Summary: ODFF: Make COUNT ignore error results
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: recent-trunk
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: oc
QA Contact: issues@sc
Keywords: ms_interoperability
: 51068 (view as issue list)
Depends on:
Blocks: 72764
  Show dependency tree
Reported: 2008-03-03 13:22 UTC by ooo
Modified: 2013-08-07 15:15 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---

A patch (3.30 KB, text/plain)
2008-03-05 03:47 UTC, lvyue
no flags Details
Another patch (4.18 KB, text/plain)
2008-03-07 06:41 UTC, lvyue
no flags Details
patch3 (4.74 KB, text/plain)
2008-03-07 06:48 UTC, lvyue
no flags Details
patch4 of i86643 (5.17 KB, text/plain)
2008-03-14 09:05 UTC, lvyue
no flags Details
patch 5. Reset nGlobalError, and handle all errors. (5.00 KB, text/plain)
2008-03-20 04:51 UTC, lvyue
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
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
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.
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.

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]
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. :)

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:

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 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. ***