Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-27-2022, 03:03 AM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,970
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Undefined sorting in composite columns

I wanted to fix some stubborn multi-column sorting (e.g. currently-reading books getting separated depending on whether or not they were on the TBR list) and the best way I figured to do it was to combine #currentlyreading and #onreadinglist:

Code:
program:
	if $$#percentread >=# 1 && $$#percentread <=# 99
	then 'Currently Reading'

	elif $#readinglist == 'To Be Read' && $$#percentread ==# 0
	then 'To Be Read'

	else 'zzz'

	fi
But is there a more elegant way to make undefined values sort to the bottom when using A-Z sort?

Last edited by ownedbycats; 01-27-2022 at 03:53 AM.
ownedbycats is offline   Reply With Quote
Old 01-27-2022, 04:32 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,443
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I wanted to fix some stubborn multi-column sorting (e.g. currently-reading books getting separated depending on whether or not they were on the TBR list) and the best way I figured to do it was to combine #currentlyreading and #onreadinglist:

Code:
program:
	if $$#percentread >=# 1 && $$#percentread <=# 99
	then 'Currently Reading'

	elif $#readinglist == 'To Be Read' && $$#percentread ==# 0
	then 'To Be Read'

	else 'zzz'

	fi
But is there a more elegant way to make undefined values sort to the bottom when using A-Z sort?
Composite columns cannot be undefined. They always contain at least the empty string.

In your case I would choose different strings for 'Currently Reading' and 'To Be Read' that sort 'correctly' in a descending sort. For example, 'Currently Reading' ==> 'Now Reading' and 'To Be Read' ==> 'Future'.
chaley is offline   Reply With Quote
Advert
Old 01-27-2022, 06:16 AM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,970
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
That will work.
ownedbycats is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting of composite numerical columns with formatting ownedbycats Library Management 4 06-26-2021 03:45 PM
Custom Columns: Undefined values ownedbycats Library Management 0 03-16-2021 09:00 PM
Should composite columns appear in Grouped Searches? ownedbycats Library Management 3 02-13-2021 03:43 PM
Quickview and composite columns ownedbycats Library Management 2 12-25-2020 04:43 PM
Sorting and undefined values ownedbycats Library Management 3 07-22-2020 01:32 PM


All times are GMT -4. The time now is 11:44 AM.


MobileRead.com is a privately owned, operated and funded community.