![]() |
#1 |
Member
![]() 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! |
![]() |
![]() |
![]() |
#2 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#4 | ||
Member
![]() Posts: 13
Karma: 10
Join Date: Sep 2009
Location: Rio de Janeiro, Brasil
Device: PRS-600
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#5 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
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 '' 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 But it does affect searching. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |