Bug 122975

Summary: CALC: Filter should be applied to the whole column, not just to the last cell with value
Product: LibreOffice Reporter: roger.millichamp
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: enhancement CC: 79045_79045, aron.budea, erack, oliver.brinzing, timur, xiscofauli
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=119949
https://bugs.documentfoundation.org/show_bug.cgi?id=143103
https://bugs.documentfoundation.org/show_bug.cgi?id=158440
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 109326    
Attachments: standard filter color background

Description roger.millichamp 2019-01-25 17:40:34 UTC
Description:
If I filter a column to only display non empty rows then rows that are empty are displayed.

Steps to Reproduce:
1.In a new spreadsheet: 
    a) column A: put a value in rows 1 to 3
    b) Column B: put a value in row 2
2. Apply a filter:
    a) Select the whole of Column B by selecting the column label
    b) Select the menu item Data-> More Filters -> Standard Filter which opens the standard filter dialogue
    c) The selection in Column B will now change to select only rows 1 and 2. 
       This is not correct
    d) In the dialogue set Column B: Condition: =, Value: Not Empty, and then OK


3.

Actual Results:
Rows 2 and 3 will be displayed

Expected Results:
1) In step 2c either the whole of Column B should remain selected on rows 1 to 3 should be selected
2) In the final result only row 2 should be displayed as that is the only rows in Column B that has a value


Reproducible: Always


User Profile Reset: Yes



Additional Info:
The above is not correct behaviour because the user will expect the filter to be applied to what the user selected and will not expect Calc to modify the selection.

Fix: The filter should be applied to the rows in Column B that have a value in ANY column rather than just those that have a value in Column B.

Version: 6.1.4.2 (x64)
Build ID: 9d0f32d1f0b509096fd65e0d4bec26ddd1938fd3
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: en-GB (en_GB); Calc: CL
Comment 1 Roman Kuznetsov 2019-01-26 07:44:06 UTC
IMHO, it's not a bug. 
Because you use filter only for B column and Calc shows you only one not empty row (with value in row 2) in column B. And this is expected behavior (for me).
In your case you should select a range A1:B3 and then use Standard filter with your options "Column B: Condition: =, Value: Not Empty, and then OK"

Eike, please look at it
Comment 2 roger.millichamp 2019-01-26 17:49:01 UTC
Thank you for your comment.

I still think this is a bug. The spreadsheet used to explain the problem is just an example the real one has 384 rows so selecting the column by dragging a selection down it isn't practical. At present I have a dummy enrty in row 385 so that when the filter is applied the selection still covers all the rows of the column that could have values.

The key point is that the user selected the entire column and would expect the filter to be applied to the entire column and not have calc change the selection. It took me a while to work out what was going on and put the dummy entry in the row 385 and I doubt users would expect to do this.
Comment 3 roger.millichamp 2019-01-27 13:58:40 UTC
A further example is the following:

1) Create a spreadsheet with values in cells A1-3 and the value 4 in cell B2
2) Select column B by selecting the column label
3) Apply a filter to show values in Column B <10

Row 1 will not be displayed because it has ho value, row 2 will be displayed because B2 has a value < 10, row 3 is displayed even though it has no value in column B.

Thus rows 1 and 3 have the same value in Column B but are treated differently because one is above the last value in Column B and the other is below it. This surely can't be correct.
Comment 4 Xisco FaulĂ­ 2019-07-31 11:33:59 UTC Comment hidden (obsolete)
Comment 5 roger.millichamp 2019-08-23 18:11:01 UTC Comment hidden (obsolete)
Comment 6 Timur 2019-10-03 10:54:16 UTC
I'm not sure about this, but seems like an enhancement, I'll set to New.
Comment 7 Regis Perdreau 2023-09-05 10:58:43 UTC
Hi,
The problem is that we now have the "background colour" parameter to define the standard filter.
We have no detection of the number of cells in the column.
- If the cells have no background, we have to take the content into account.
- If a cell has a coloured background, we must take  account the last cell with a background OR the cell with content.

For the moment, the list of background colours only takes  account the first cell if there is no content in the cell. 
Expected: all cells with a background colour are taken  account...
Comment 8 Regis Perdreau 2023-09-25 14:19:41 UTC
Created attachment 189809 [details]
standard filter color background
Comment 9 Regis Perdreau 2023-09-25 14:20:41 UTC
See screenshot to see what expected : all colors should be in the background color list