Recent

Author Topic: FpSpreadsheet Sort limits?  (Read 548 times)

straetch

  • Jr. Member
  • **
  • Posts: 86
FpSpreadsheet Sort limits?
« on: April 06, 2026, 06:00:38 pm »
I have a worksheet with 13076 rows and 12 columns.
After a sort the worksheet only contains 11984 rows. The rows are in the expected sort order

Code: Pascal  [Select][+][-]
  1.   sortParams := InitSortParams(true, 1);  // sorting along columns, 1 sorting key
  2.   sortParams.Keys[0].ColRowIndex := 0; // primary sorting key, ascending, case-insensitive
  3.   sortParams.Keys[0].Options := [ssoCaseInsensitive];
  4.   OutputWS.Sort(sortParams,0,0,OutputWS.GetLastOccupiedRowIndex,OutputWS.GetLastOccupiedColIndex);
  5.  
Are there limitations on the size of the worksheet for sorting?

wp

  • Hero Member
  • *****
  • Posts: 13483
Re: FpSpreadsheet Sort limits?
« Reply #1 on: April 06, 2026, 07:51:03 pm »
I have a worksheet with 13076 rows and 12 columns.
After a sort the worksheet only contains 11984 rows.
 Are there limitations on the size of the worksheet for sorting?
Nothing special (except for the size limitations of the output file formats, but your 13000 rows are still far away from the smallest rowcount of Excel 2.1, and xlsx allows even more than 1 million rows).

Is your application 32bit, and you are running out of memory?

In the attached project I am creating a spreadsheet with random strings in 50,000 rows and 50 columns (it will take some time...), and I am not seeing any loss of rows.

straetch

  • Jr. Member
  • **
  • Posts: 86
Re: FpSpreadsheet Sort limits?
« Reply #2 on: April 08, 2026, 09:39:06 am »
Thank you for your response and the short demo. Sort is a solid function within the excellent FpSpreadsheet.
The difference in number of rows: Sort eliminates empty rows.

wp

  • Hero Member
  • *****
  • Posts: 13483
Re: FpSpreadsheet Sort limits?
« Reply #3 on: April 08, 2026, 09:53:06 am »
Do you think there should be an option "Keep empty rows"?

Zvoni

  • Hero Member
  • *****
  • Posts: 3349
Re: FpSpreadsheet Sort limits?
« Reply #4 on: April 08, 2026, 10:54:41 am »
Thank you for your response and the short demo. Sort is a solid function within the excellent FpSpreadsheet.
The difference in number of rows: Sort eliminates empty rows.
*facepalm*
sorting doesn't "eliminate" empty rows.....
it sorts them where they belong: in ascending order they are sorted to the end

and then you call
GetLastOccupiedRowIndex

Why should an Empty Row/Cell, which has been sorted to the end of the list, be considered in that function-call?

Do you think there should be an option "Keep empty rows"?
No.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

straetch

  • Jr. Member
  • **
  • Posts: 86
Re: FpSpreadsheet Sort limits?
« Reply #5 on: April 08, 2026, 11:39:16 am »
I see no need for an option "Keep empty rows" (meaning GetLastOccupiedRowIndex would include the empty rows?).
The application programmer can take the current behavior into account. Proposal: just mention it in the documentation.

 

TinyPortal © 2005-2018