Bug 138165 - AND and OR formulas don't support ranges
Summary: AND and OR formulas don't support ranges
Status: RESOLVED FIXED
Alias: None
Product: calligrasheets
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Sebastian Sauer
URL:
Keywords:
: 131809 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-11-30 15:34 UTC by Sebastian Sauer
Modified: 2006-12-01 21:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch that implements ranges for AND+OR (2.02 KB, patch)
2006-11-30 18:43 UTC, Sebastian Sauer
Details
Patch that implements ranges for AND+OR+NAND+NOR+XOR (3.74 KB, patch)
2006-12-01 17:54 UTC, Sebastian Sauer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Sauer 2006-11-30 15:34:29 UTC
Version:           1.6.1 (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

At least the AND+OR formulas should also support ranges/arrays like AND(A1:A5;B1:B5). This isn't only more comfortable but also needed to provide better OpenFormula-compatibility.
Comment 1 Sebastian Sauer 2006-11-30 18:43:06 UTC
Created attachment 18736 [details]
Patch that implements ranges for AND+OR

This patch against the KOffice 1.6 branch implements support for ranges/arrays
for the AND and the OR formula functions. Testing doesn't show any regressions.


Following cases are now valid;
AND(A1)
AND(A1,A2)
AND(A1:A5)
AND(A1:A5;B1:B10)
OR(A1)
OR(A1,A2)
OR(A1:A5)
OR(A1:A5;B1:B10)

Not committed yet cause it may needed to also extend other logical functions to
support ranges too. Would be nice if someone tests OOo and provides a list of
formula functions that may need to support ranges as well.
Comment 2 Sebastian Sauer 2006-11-30 18:45:51 UTC
before I forget it; the patch does not include the changed xml-file which also needs to be extended (e.g. the samples should also include such range-definitions and the argument-descriptions need to be changed as well).
Comment 3 Matthias 2006-11-30 20:50:06 UTC
This is a duplicate of bug 131809 (which i reported).
Comment 4 Sebastian Sauer 2006-11-30 23:54:23 UTC
*** Bug 131809 has been marked as a duplicate of this bug. ***
Comment 5 Sebastian Sauer 2006-12-01 00:03:56 UTC
TODO I'll look at next days;
* check+maybe implement it also for e.g. IF, NOT, TRUE, FALSE, NAND, NOR, XOR
* we really could need a complete function-review here to check if there are more functions where OOo allows to define ranges too. Propably it may also an idea to have those parts more generic for 2.0 ( maybe related to http://lists.kde.org/?l=koffice-devel&m=116484095414360&w=2 ).
Comment 6 Tomas Mecir 2006-12-01 11:40:26 UTC
30 Nov 2006 23:03:57 -0000, Sebastian Sauer <mail@dipe.org>:
> * we really could need a complete function-review here to check if there are more functions where OOo allows to define ranges too. Propably it may also an idea to have those parts more generic for 2.0 ( maybe related to http://lists.kde.org/?l=koffice-devel&m=116484095414360&w=2 ).


OOo or not, we shall go for compatibility with ODF functions - which
OOo is going for as well.
Comment 7 Sebastian Sauer 2006-12-01 15:51:12 UTC
> OOo or not, we shall go for compatibility with ODF functions - which OOo is going for as well. 

True. I looked at the latest OpenFormula-draft ( http://www.oasis-open.org/committees/download.php/21372/openformula-20061129.odt ) and it does not mention that e.g. the AND()-function supports arrays but it also does not mention that it does not. So, IMHO the spec should be extended to explicit allow arrays for logical functions like AND() cause it just makes sense. The alternate would be to fill a bugreport against OOo but I guess they would mark it as invalid/won't fix cause it may break existing documents that worked before. So, the only alternate I see here is to let KSpread behave like OOo and to extend the specs...
Comment 8 Sebastian Sauer 2006-12-01 16:57:03 UTC
Comparing the logical functions, AND, OR, NAND, NOR and XOR are affected. The specs are only defining AND, OR and XOR ( NAND==NOT(AND()) && NOR=NOT(OR()) ) where OOo does not implement XOR ( filled now as http://www.openoffice.org/issues/show_bug.cgi?id=72182 ).
Comment 9 Sebastian Sauer 2006-12-01 17:54:28 UTC
Created attachment 18744 [details]
Patch that implements ranges for AND+OR+NAND+NOR+XOR

This patch against the KOffice 1.6 branch implements support for ranges/arrays
for the AND, OR, NAND, NOR and XOR formula functions. Also it does try to
simplify the code at NAND+NOR by reusing the reverse of there AND+NR
counterparts. As usual tested and so far no regressions did show up.
Comment 10 Sebastian Sauer 2006-12-01 21:33:47 UTC
The patch got committed now to the 1.6-branch and trunk. Thanks for the feedback, Matthias.