Bug 162964 - Automatically exclude totals row when sorting a database range
Summary: Automatically exclude totals row when sorting a database range
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-DataRange
  Show dependency treegraph
 
Reported: 2024-09-14 15:59 UTC by Regina Henschel
Modified: 2024-09-16 14:58 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
file with database range to reproduce the sorting problem (24.21 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-09-14 15:59 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2024-09-14 15:59:24 UTC
Created attachment 196444 [details]
file with database range to reproduce the sorting problem

Open attached document. It has a database range.
Set cursor to a data cell.
Menu Data > Define...
You get the "Define Database Range" dialog and the database range "myData" should be preselected.
Open the "Options" section.
Check "Contains totals row".
Click on "Modify" button.
OK

[You need to do the above because of bug 162963.]

Menu > Data > Select Range. Use "myData". OK.
Menu > Data > Sort...
Chose 'Age' as first key.
Notice, the option "Headers: Contains column labels" is checked. But there exists no such option for "Contains totals row".
OK

Notice that the totals row has been moved by sorting.

Request:
(1) Make sorting a database range automatically detect, whether the database range has a totals row and exclude it from sorting.
(2) Add an option "Totals: Contains totals row" to the "Sort..." dialog, so that it can be used too, if the to be sorted cell area is not a defined database range.
Comment 1 Regina Henschel 2024-09-14 21:49:17 UTC
Currently struct ScSortParam has no member for totals row and I see the comment
402      /* TODO: add Totals to ScSortParam? */
in https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/dbdata.cxx
Comment 2 m_a_riosv 2024-09-14 23:50:38 UTC
+1
Reproducible the scenario with
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 47a348bb0fd6dfdd93c1975d216daadc4f6b9b6f
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded