Issue 23299 - subtotal does not update when filter changes
Summary: subtotal does not update when filter changes
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOO 2.0 Beta2
Hardware: All All
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: frank
QA Contact: issues@sc
URL:
Keywords:
: 62589 (view as issue list)
Depends on:
Blocks: 72764
  Show dependency tree
 
Reported: 2003-12-08 11:28 UTC by sparcmoz
Modified: 2013-08-07 15:14 UTC (History)
3 users (show)

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


Attachments
subtotal will not update (8.06 KB, application/octet-stream)
2003-12-08 11:43 UTC, sparcmoz
no flags Details
23299.patch (730 bytes, text/plain)
2007-07-10 09:04 UTC, gaozm
no flags Details
23299.patch (854 bytes, text/plain)
2007-07-19 09:04 UTC, gaozm
no flags Details
23299.patch (718 bytes, text/plain)
2007-07-23 08:31 UTC, gaozm
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description sparcmoz 2003-12-08 11:28:42 UTC
The formula subtotal(9;range1:range2) does not recalculate when the filter
changes. This file was made on sparc linux fix111 but the file shows the problem
in windows 98. Make a new filter and the problem goes away.
Comment 1 sparcmoz 2003-12-08 11:43:47 UTC
Created attachment 11809 [details]
subtotal will not update
Comment 2 frank 2003-12-08 15:00:16 UTC
Hi Niklas,

I think autofiltered values should not be used in calculation if they are not
visible.

Frank
Comment 3 sparcmoz 2003-12-08 20:29:45 UTC
I did this building fix111 but i also used the updated the file
source/core/data/table3.cxx to version 1.15.164.1 to test the fix of the top ten
issue. Maybe this is not related.
Please note therefore I am not using any standard build version. 
The error was found by chance when I noticed subtotals did not update but I have
not been able to make another file with the error. The example file is just a
cut down version of the original. 
Comment 4 frank 2004-05-05 10:44:07 UTC
Due to time problems this is re-targeted to OOo2.0
Comment 5 fitirocz 2004-09-22 21:59:20 UTC
When trying to figure out how this bug works, I tried typing in the 
spreadsheet.  It was in read only mode though and gave an error saying so.  
However, the error message would go away but the text box would stay and not 
refresh off the screen unless you manual do it by minimizing it and 
remaximizing it.  Or toggling between different windows.

System Specs:
XP Pro SP2
P4 3.0 GHz
1 GB RAM
60 GB harddrive
Open Office v.1.1.2
Comment 6 sparcmoz 2004-09-22 22:45:31 UTC
openoffice will not edit a "read only" file. If you save the file locally with a
with a new file name it should be OK. To observe the problem just select a value
in the filter button

A possible explanation for this bug: there is no database range defined in the
worksheet where the filter is defined.
Comment 7 sparcmoz 2004-09-22 23:01:02 UTC
I save this example in excel format demo.xls. then close and re-open the excel
file. now there is database range defined as Excel_builtin_filter_database_1.

I modified this range to include column C and the subtotal functions correctly.
Remove column c from the range again and the error occurs.

So maybe this is a feature - subtotal function does not update for data outside
the filter database range. 

Now it can be reproduced this way:

Step 1 - set up a filtered list.
Step 2 - add some data in a different column not included in the filtered list
range.
Step 3 - enter subtotal formula over both columns.

Only the subtotal over the original filtered range will update.
Comment 8 sparcmoz 2005-09-17 13:15:06 UTC
I can describe this problem better.

When a filtered list changes by a filtering action (different rows are selected
to be hidden) then recalculation is only applied to cells in the defined
filtered range, and cells that depend on those. Therefore a subotal of cells
outside the filter does not recalculate.

If calculation is forced after a filter change (ctrl-shift-F9) then the subotal
of cells outside the filter range is recalculated as expected.

So I am guessing the real problem is that the scope of recalculation is
restricted to the defined filter range and cells depending on that range, when
recalculation is triggered by a filtering action.  I believe this behaviour is a
bug, because users can do things that will require recalculation, outside the
assumed scope of recalculation. 
Comment 9 niklas.nebel 2006-03-08 18:24:27 UTC
*** Issue 62589 has been marked as a duplicate of this issue. ***
Comment 10 daveboden 2006-03-08 22:16:44 UTC
I'll post a $20 donation via PayPal as soon as this issue is fixed and available
for download. Trying to do my taxes, and the autofilter dynamic subtotals are a
showstopper for me. Thanks!
Comment 11 niklas.nebel 2006-03-09 08:50:06 UTC
As a workaround, just change the filter range to include the column with the
values to sum.
The bug still needs to be fixed, of course.
Comment 12 gaozm 2007-07-10 09:04:50 UTC
Created attachment 46669 [details]
23299.patch
Comment 13 niklas.nebel 2007-07-10 09:55:26 UTC
This change would modify the database range, just by opening the filter entry
list. That's not a good idea, it's too surprising. Also, it wouldn't work for
formulas that aren't directly adjacent to the filtered range.
Comment 14 sparcmoz 2007-07-10 11:25:44 UTC
My current thinking is: this is not really a defect, it is a feature because OOo
allows multiple filters in one sheet. A better solution would be the enhancement
issue that asks for a blue line to be shown around the filter range - I will try
and find that one ;)
Comment 15 sparcmoz 2007-07-10 11:32:06 UTC
Please have a look at issue 11870 and issue 14251
Comment 16 gaozm 2007-07-19 09:04:18 UTC
Created attachment 46912 [details]
23299.patch
Comment 17 niklas.nebel 2007-07-19 13:03:01 UTC
Modifying ScTable::SetDirty would change the notification for all range
operations, not just the filtering. That's not a good idea.

Apart from that, the existing constants should be used instead of numbers like
255, and there could also be formulas to the left of the database range.
Comment 18 gaozm 2007-07-20 02:36:09 UTC
Do you think this change will lead to other problems?
Comment 19 gaozm 2007-07-23 08:31:15 UTC
Created attachment 46988 [details]
23299.patch
Comment 20 niklas.nebel 2007-09-05 17:26:27 UTC
The fix (last patch from gaozm) is in CWS "calc44" (for OOo 2.4).
Comment 21 niklas.nebel 2007-09-05 17:39:45 UTC
Type is "patch".
Comment 22 sparcmoz 2007-09-05 23:33:44 UTC
Verified the patch is in calc44 and the feature works as expected in the
attached test case file, and with formula in remote cells including all four
corners of the spreadsheet.
Comment 23 niklas.nebel 2007-09-18 13:46:38 UTC
sparcmoz, thanks for checking, but let's follow the usual procedure of QA
verifying the issue on the final CWS build.
Comment 24 niklas.nebel 2007-09-18 13:47:14 UTC
Setting "fixed" again.
Comment 25 niklas.nebel 2007-09-18 13:47:49 UTC
Reassigning to QA for verification.
Comment 26 frank 2007-09-26 11:54:57 UTC
found fixed on cws calc44 using Solaris, Windows and Linux build
Comment 27 frank 2007-12-11 14:59:22 UTC
found integrated on master m239 using Linux, Solaris and Windows build