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 06-16-2023, 10:17 AM   #1
Luiztfc
Member
Luiztfc began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2009
Location: Rio de Janeiro, Brasil
Device: PRS-600
Ordinal numbers in custom columns (1st, 2nd, 3rd etc)

Hi!

I have the same books in different editions and it's useful to keep them to check the differences. I tried to add a custom column to account for this (Edition) but in the "column type" I chose interger, which does not allow me use add numbers in ordinal format (1st, 2nd, 3rd etc). I thought about using a "text" column type, but I wonder if this would end up limiting my ability to sort books by edition.

Is there a better way to do this?

Thank you!
Luiztfc is offline   Reply With Quote
Old 06-16-2023, 11:58 AM   #2
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,961
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Text is one option.

You may also be able to use a composite column that checks the integer and convert it to text. But that's a bit more of an effort.
ownedbycats is offline   Reply With Quote
Advert
Old 06-16-2023, 12:51 PM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
If the columns purpose is Edition, why Ordinal?
2 in the edition column is the second edition

Also note you need to pad text if the number is above 9 if you want to sort (alpha sort rule)

Personally, I just append (2nd ed) to the title
Stuff in the paren does not affect the sort value
theducks is offline   Reply With Quote
Old 06-16-2023, 01:08 PM   #4
Luiztfc
Member
Luiztfc began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2009
Location: Rio de Janeiro, Brasil
Device: PRS-600
Quote:
Originally Posted by ownedbycats View Post
Text is one option.

You may also be able to use a composite column that checks the integer and convert it to text. But that's a bit more of an effort.
Good idea, thank you!

Quote:
Originally Posted by theducks View Post
If the columns purpose is Edition, why Ordinal?
2 in the edition column is the second edition

Also note you need to pad text if the number is above 9 if you want to sort (alpha sort rule)

Personally, I just append (2nd ed) to the title
Stuff in the paren does not affect the sort value
You're right, there's no practical reason to do this. I hadn't thought about adding the edition in parenthesis. Thank you.
Luiztfc is offline   Reply With Quote
Old 06-16-2023, 01:55 PM   #5
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,961
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Note that you can use a comments/long-text type column set to 'title'.

Depending on your use, this may be more suitable as It won't appear as a category in the tag browser or be a clickable link in book details. I use it for subtitles.
ownedbycats is offline   Reply With Quote
Advert
Old 06-16-2023, 03:09 PM   #6
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,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
You may also be able to use a composite column that checks the integer and convert it to text. But that's a bit more of an effort.
For fun I made a template for a composite column to calculate the ordinal from the integer. You put the integer of the edition in some column, in my case #myint. You make a composite column with one of these two templates. You would sort and search on the integer column. You would display the composite.

General Program Mode:
Code:
program:
	n = raw_field('#myint', '');
	if n then
		t = mod(n, 100);
		if t >=# 4 && t <=# 20 then
			suffix = 'th'
		else
			dex = mod(t, 10);
			if dex >=# 4 then dex = 4 fi;
			suffix = list_item('th,st,nd,rd,th', dex, ',')
		fi;
		return n & suffix
	fi;
	return ''
Python Template Mode (much faster):
Code:
python:
def evaluate(book, context):
	n = book.get('#myint')	
	if n is None:
		return ''
	if 4 <= (n % 100) <= 20:
		suffix = 'th'
	else:
		suffix = ['th', 'st', 'nd', 'rd', 'th'][min(n % 10, 4)]
	return str(n) + suffix
(Code from Stack Overflow)

Quote:
Originally Posted by theducks View Post
Personally, I just append (2nd ed) to the title
Stuff in the paren does not affect the sort value
But it does affect searching.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Oxford dictionary 2nd or 3rd edition on 11th gen Kindles? ksks Amazon Kindle 16 11-04-2022 02:11 AM
Ratings Custom Columns Created From other Columns Tanjamuse Library Management 4 09-28-2020 12:57 AM
Help Needed for Custom Columns Created From other Columns Tanjamuse Library Management 5 09-02-2018 06:19 PM
Need help in Custom Columns, template syntax, and rounding numbers dennocoil Calibre 0 07-10-2017 03:24 PM
K1 Owners: Have you bought a 2nd (or 3rd...) ereader & if so, what? texasnightowl Amazon Kindle 14 07-28-2010 08:34 PM


All times are GMT -4. The time now is 01:57 AM.


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