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 08-21-2024, 08:55 AM   #1
Massreader
Enthusiast
Massreader began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: none
Format-Code for columns with numbers

Hello,

I want to create two individual columns, but I just can't handle the format for numbers.

One column should show numbers with a decimal comma (e.g. 4,5). I would choose floating point as the column type.

The second column should represent integers with a point separating the thousands.

What do I have to enter as the format code in each case to get the desired display?

Many thanks in advance for any help!

Last edited by Massreader; 08-21-2024 at 09:10 AM.
Massreader is offline   Reply With Quote
Old 08-21-2024, 10:26 AM   #2
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: 30,440
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Right click that columns header: Edit custom column: (see image)

This uses Python formatting rules (link is in the dialog box)
Attached Thumbnails
Click image for larger version

Name:	CC formatting.JPG
Views:	49
Size:	46.5 KB
ID:	210336  
theducks is offline   Reply With Quote
Advert
Old 08-21-2024, 04:32 PM   #3
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,245
Karma: 6426810
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Massreader View Post
The second column should represent integers with a point separating the thousands.
for that one I've found {0:n} to work fine, I just tested it.
Comfy.n is offline   Reply With Quote
Old 08-21-2024, 04:54 PM   #4
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,245
Karma: 6426810
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Massreader View Post
One column should show numbers with a decimal comma (e.g. 4,5). I would choose floating point as the column type.
{:n} seems to work! (but I would wait for more experienced members' advice)

And I think you need to be using a compatible locale, I mean, the Calibre UI language, such as German, seems relevant in order to allow manual inputs with the comma instead of dot/point. If you have English as the Calibre UI language, you can insert manually 4 point 5 (not 4 comma 5), but in Book Details that number will still show as 4,5.

According to https://docs.python.org/3/library/st...-string-syntax :

'n' - Number. This is the same as 'g', except that it uses the current locale setting to insert the appropriate number separator characters.

Last edited by Comfy.n; 08-21-2024 at 05:06 PM.
Comfy.n is offline   Reply With Quote
Old 08-24-2024, 12:14 PM   #5
Massreader
Enthusiast
Massreader began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: none
Thank you very much!

It works. :-)
Massreader is offline   Reply With Quote
Advert
Old 08-24-2024, 03:42 PM   #6
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,245
Karma: 6426810
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Massreader View Post
Thank you very much!

It works. :-)
Thanks for confirming
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto registration of new custom columns from plugin code [question/feature request]] Sud0 Development 4 12-06-2023 02:57 AM
Ordinal numbers in custom columns (1st, 2nd, 3rd etc) Luiztfc Library Management 5 06-16-2023 03:09 PM
Bullet,numbers, indents and alignment greyed out in code view. handycrowd Sigil 4 02-13-2018 03:29 AM
Need help in Custom Columns, template syntax, and rounding numbers dennocoil Calibre 0 07-10-2017 03:24 PM
Strange Code Replaces Numbers Gwaredd Conversion 1 07-23-2013 12:03 PM


All times are GMT -4. The time now is 10:24 AM.


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