Register Guidelines E-Books Search Today's Posts Mark Forums Read

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
Wizard
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: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
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 online now   Reply With Quote
Old 01-27-2022, 04:32 AM   #2
chaley
Grumpy old git
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.
 
chaley's Avatar
 
Posts: 10,380
Karma: 3933793
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
Wizard
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: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
That will work.
ownedbycats is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:09 PM.


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