Bug 56187 - Standard Filter gets wrong criteria from Autofilter and vice versa
Summary: Standard Filter gets wrong criteria from Autofilter and vice versa
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 140270 147578 (view as bug list)
Depends on:
Blocks: Data-Filter
  Show dependency treegraph
 
Reported: 2012-10-19 15:56 UTC by oli
Modified: 2022-07-30 18:31 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Test data to reproduce the Errors (9.79 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-10-19 15:56 UTC, oli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description oli 2012-10-19 15:56:17 UTC
Created attachment 68805 [details]
Test data to reproduce the Errors

Terms: 
- Autofilter (AF)
- Standard Filter (SF)

Please do the following:

* load Test.ODS:

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
7	3	a
8	3	b
9	3	c
10	4	a
11	4	b
12	4	c

* click Wert_1 / AF ; unmark [3] and [4] ; click <ok>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF ; click <Standard Filter ...> and look at the creteria:
   Wert_1 = 1
only the first creteria from AF is passed to SF 

It should read:
   Wert_1 = 1
OR Wert_1 = 2

the second line is missing ;

  click <Cancel>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c

* click Wert_2 / AF ; unmark [a] ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_2 / AF ; click <Standard Filter ...> and look at the creteria:
    Wert_1 = 1
AND Wert_2 = b

only the first AF-creteria from each column is passed to SF
OR-Creteria and brackets!!! are not considered about.
So this should read without brackets

    Wert_1 = 1
AND Wert_2 = b
OR  Wert_1 = 1
AND Wert_2 = c
OR  Wert_1 = 2
AND Wert_2 = b
OR  Wert_1 = 2
AND Wert_2 = c

[maybe somebody can think about introducing brackets, then we would get:
(Wert_1 = 1 OR Wert_1 = 2) AND (Wert_2 = b OR Wert_2 = c)   ] 

 add missing lines to SF ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF and look at the checkboxes
only [1] is checked ; 2 is missing!!

  click <ok> 

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is wrong!)

Either [2] should be checked or this should read:

Zeile	Wert_1	Wert_2
2	1	b
3	1	c

* click Wert_2 / AF and look at the checkboxes
only [b] is checked ; c is missing!!
the same like above-

--- end of test ---

please check filter syntax
thank you!
Comment 1 ign_christian 2013-06-09 15:04:01 UTC
I can confirm this behavior using LO 4.0.4.1 (Win7 32bit)

Standard filter isn't synchronized with Auto filter when used in conjuction. That behavior could confusing users.

> [maybe somebody can think about introducing brackets, then we would get:
> (Wert_1 = 1 OR Wert_1 = 2) AND (Wert_2 = b OR Wert_2 = c)   ] 
Perhaps it's a good idea if possible. Don't know how that behave on Excel?
Comment 2 QA Administrators 2015-03-16 23:57:57 UTC Comment hidden (obsolete)
Comment 3 oli 2015-03-17 17:23:19 UTC
Bug is still present in LibO 4.4.1.2
Build-ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Windows 7 x64

but behavior of LibO has changed:

standardfilter now gets the LAST criteria from autofilter, not the FIRST one as indicated in the original Report

if you perfom the test with the TEST.ods file you get

...
* click Wert_1 / AF ; unmark [3] and [4] ; click <ok>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF ; click <Standard Filter ...> and look at the creteria:
   Wert_1 = 2 (<<<--- 4.4.1.2; was 1 in 3.5.6.2)
only the LAST (<<<--- 4.4.1.2; was FIRST in 3.5.6.2) creteria from AF is passed to SF 

It should read:
   Wert_1 = 1
OR Wert_1 = 2

the FIRST (<<<--- 4.4.1.2; was LAST in 3.5.6.2) line is missing ;

  click <Cancel>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c

* click Wert_2 / AF ; unmark [a] ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_2 / AF ; click <Standard Filter ...> and look at the creteria:
    Wert_1 = 2 (<<<--- 4.4.1.2; was 1 in 3.5.6.2)
AND Wert_2 = c (<<<--- 4.4.1.2; was b in 3.5.6.2)

only the LAST (<<<--- 4.4.1.2; was first in 3.5.6.2) AF-creteria from each column is passed to SF
OR-Creteria and brackets!!! are not considered about.

...

Maybe someone has some time to fix this
Comment 4 tommy27 2016-04-16 07:29:07 UTC Comment hidden (obsolete)
Comment 5 oli 2016-04-17 14:05:46 UTC
Tested on LibO 5.1.2.2 (x64) Build-ID: d3bf12ecb743fc0d20e0be0c58ca359301eb705f

Behaviour of Autofilter/Standardfilter changed, but is still wrong: now again exactely as originally described for LibO 3.5.6.2 at 2012-10-19 15:56:17 UTC.
Comment 6 oli 2017-04-20 16:36:08 UTC
bug reproduced as filed by 2012-10-19

Version: 5.3.2.2 (x64)
Build-ID: 6cd4f1ef626f15116896b1d8e1398b56da0d0ee1
CPU-Threads: 8; BS-Version: Windows 6.1; UI-Render: Standard; Layout-Engine: neu; 
Gebietsschema: de-DE (de_DE); Calc: group
Comment 7 Xisco Faulí 2017-06-12 11:36:47 UTC
Changing version back to the earliest affected version.
Comment 8 superurbi 2017-10-19 12:10:31 UTC
And not only that (I'm a "little" frustrated) if you filter a simple excel sheet in Excel and open it in calc you find that the "personalized filter" used in excel is not syncronized to Calc filter not (AF) nor (SF)... really anoying... this should be a very basic stuff already working... but not... sorry for my bad mood.
Comment 9 QA Administrators 2018-10-20 02:53:26 UTC Comment hidden (obsolete)
Comment 10 oli 2018-10-24 15:01:09 UTC
Bug is still present at

Version: 6.1.1.2 (x64)
Build-ID: 5d19a1bfa650b796764388cd8b33a5af1f5baa1b
CPU-Threads: 8; BS: Windows 6.1; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc: group threaded

Today's test results:

Terms: 
- Autofilter (AF)
- Standard Filter (SF)

Please do the following:

* load Test.ODS:

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
7	3	a
8	3	b
9	3	c
10	4	a
11	4	b
12	4	c

* click Wert_1 / AF ; unmark [3] and [4] ; click <ok>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF ; click <Standard Filter ...> and look at the creteria:
   Wert_1 = 1
only the first creteria from AF is passed to SF 

It should read:
   Wert_1 = 1
OR Wert_1 = 2

the second line is missing ;

  click <Cancel>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c

* click Wert_2 / AF ; unmark [a] ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_2 / AF ; click <Standard Filter ...> and look at the creteria:
    Wert_1 = 1
AND Wert_2 = b

only the first AF-creteria from each column is passed to SF
OR-Creteria and brackets!!! are not considered about.
So this should read without brackets

    Wert_1 = 1
AND Wert_2 = b
OR  Wert_1 = 1
AND Wert_2 = c
OR  Wert_1 = 2
AND Wert_2 = b
OR  Wert_1 = 2
AND Wert_2 = c

[maybe somebody can think about introducing brackets, then we would get:
(Wert_1 = 1 OR Wert_1 = 2) AND (Wert_2 = b OR Wert_2 = c)   ] 

 add missing lines to SF ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF and look at the checkboxes
  [1] and [2] is checked; (this is ok)  
  click <cancel> 

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF and look at the checkboxes
  [1] and [2] is checked; (this is ok)  
  click <ok> 

Zeile	Wert_1	Wert_2
(no more lines (2-13) are shown at all!!!)
(this is wrong!)

* click Wert_1 / AF and look at the checkboxes
  there are no values / checkboxes but <all> which is checked
  click <Standard Filter...>
   
    Wert_2 = b
AND Wert_2 = c
AND Wert_2 = b
AND Wert_2 = c
AND Wert_1 = 1

(all <OR>-lines from the SF that we have entered above are missing, and the first line has moved to the end
(this is wrong!)

--- end of test ---

So sorry to say that SF and AF is still buggy

**********************************************************************
**********************************************************************

--- further test on old version ---

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

There are no checkboxes in AF-window, thus only one value per row can be selected as creteria for AF.
Therefore AF -> SF gives only <AND>-junctions between different rows. This works fine.
SF itself works fine with <AND> and <OR>, and there is no need to translate SF back to AF (as there are no checkboxes in AF). 

--> added 'regression' to keywords
Comment 11 Xisco Faulí 2018-10-26 09:40:30 UTC
Hi Oli,
if there's a new regression, it means it's a different issue.
Please report a new issue instead mentioning what the regression it. Otherwise it's really confusing for the QA Team.
Thanks in advance
Comment 12 QA Administrators 2019-10-27 03:38:00 UTC Comment hidden (obsolete)
Comment 13 oli 2019-10-27 16:55:23 UTC
Tested with 
Version: 6.3.2.2 (x64)
Build-ID: 98b30e735bda24bc04ab42594c85f7fd8be07b9c
CPU-Threads: 8; BS: Windows 6.1; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE

---------------------------------   
today's results: SF -> AF i.o.
                 AF -> SF n.i.o.
---------------------------------

Terms: 
- Autofilter (AF)
- Standard Filter (SF)

Please do the following:

* load Test.ODS:

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
7	3	a
8	3	b
9	3	c
10	4	a
11	4	b
12	4	c

* click Wert_1 / AF ; unmark [3] and [4] ; click <ok>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF ; click <Standard Filter ...> and look at the creteria:
   Wert_1 = 1
only the first creteria from AF is passed to SF 

It should read:
   Wert_1 = 1
OR Wert_1 = 2

the second line is missing ;

  click <Cancel>

Zeile	Wert_1	Wert_2
1	1	a
2	1	b
3	1	c
4	2	a
5	2	b
6	2	c

* click Wert_2 / AF ; unmark [a] ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_2 / AF ; click <Standard Filter ...> and look at the creteria:
    Wert_1 = 1
AND Wert_2 = b

only the first AF-creteria from each column is passed to SF
OR-Creteria and brackets!!! are not considered about.
So this should read without brackets

    Wert_1 = 1
AND Wert_2 = b
OR  Wert_1 = 1
AND Wert_2 = c
OR  Wert_1 = 2
AND Wert_2 = b
OR  Wert_1 = 2
AND Wert_2 = c

[maybe somebody can think about introducing brackets, then we would get:
(Wert_1 = 1 OR Wert_1 = 2) AND (Wert_2 = b OR Wert_2 = c)   ] 

  add missing lines to SF ; click <ok>

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c
(this is ok)

* click Wert_1 / AF and look at the checkboxes
[1] and [2] is checked
(this is ok now)

  click <ok> 

Zeile	Wert_1	Wert_2
2	1	b
3	1	c
5	2	b
6	2	c

* click Wert_2 / AF and look at the checkboxes
[b] and [c] is checked
(this is ok now)

  click <ok>

--- end of test ---

please check filter Syntax and AF->SF
thank you!
Comment 14 b. 2020-09-04 16:00:08 UTC
imho AF and SF and AdF (advanced Filter) are not intended to be the same, and not designed for 'cooperation', they have different capabilities (sort, comparision, duplicates, copy output, etc.), and produce even different representation in the file and different definition in the filterdescriptor for the same intention / similar input, 

AF - quick and dirty 'have a filtered look', 
SF - more complex filtering which requires thinking, and defining something, 
AdF - complex filter structures that are visible in the sheet and can be applied repeatedly - even with different specifications from different definition areas, 

it all comes together in one somehow 'special' construct 'filterdescriptor' in which similar functionalities (how to filter the fields) are mapped multiple times (Filterfields(), Filterfields2() and Filterfields3()), and SF for example uses multiple 'Filterfields3()' fields and connects them by logical or, while AF uses only one Filterfield3() and assigns multiple 'values' to it (possible only with Filterfields3()), 

that a programmer can (or even wants to, considering how many other urgent problems have to be solved) implement harmony and cooperation there seems unlikely to me ... 

current behaviour is that every tool constructs it's own ruleset, starting with first criteria from preset filters? and overpastes all other? 'last shooter wins', 

i suggest to redefine this bug as an enhancement proposal, in the sense that if someone works in this area he could keep an eye on this wish ...

it's not a 'bug' until somewhere is stated that handover of filter definitions should be possible, imho that isn't yet, and it's practically hard up to unresolveable while the capabilities are as different as they are ...
Comment 15 Stéphane Guillou (stragu) 2021-06-19 13:56:02 UTC
*** Bug 140270 has been marked as a duplicate of this bug. ***
Comment 16 raal 2022-07-30 18:31:03 UTC
*** Bug 147578 has been marked as a duplicate of this bug. ***