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 09-03-2014, 03:59 AM   #1
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
SOLVED - Help with custom column format string to force a comma

UPDATE: Solved as of Post #5.

ORIGINAL POST:
Umm..I DON'T follow all the info on this stuff but I try. I've tried various combinations but only get text of what I try returned in a custom column.

Column is #words which counts words in the book.
Current formatting is simply integer.

I want it to return the number with a comma to indicate the thousands.

I've looked at the info on Format String Syntax and the format() function.
I can't get any combo I've tried to work. It looks like it should be simple, but it ISN'T HAPPENING. I'm feeling like an idiot over this.

Could someone help with this?
Attached is a picture of the custom column window.
Attached Thumbnails
Click image for larger version

Name:	_Integers with comma.JPG
Views:	523
Size:	30.5 KB
ID:	127695  

Last edited by jecilop; 09-03-2014 at 06:25 PM. Reason: UPDATE
jecilop is offline   Reply With Quote
Old 09-03-2014, 04:11 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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Use
Code:
{:,d}
The 'd' is optional, but I like it because it documents what kind of number I think it is, in this case integer.
chaley is offline   Reply With Quote
Advert
Old 09-03-2014, 05:32 AM   #3
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
Thank you, @chaley.
Tested and working. That was far simpler than anything I was coming up with!

Next hurdle: Do you know a modification I could make to the Save to Disk "save template" that would force this also? I already having it printing the words using {#words:|(|words)} in case none are generated/exist for the type of entry.
I tested it after the comma 'fix', but it definitely isn't based on the appearance in Calibre - just the hard data.

Whoops!!! Turns out doing this affects using that column in a math function. Once the comma format is there, the simple math function (generating a custom page count) stopped working and returned an error.... Arrgh..

I'd still like to know if I can force the comma to show in the save to disk template "tag".
Interestingly, the comma shows in the book metadata jacket as desired when this code is applied. The tags or references are the same so it's curious that one shows commas and not the other.

Last edited by jecilop; 09-03-2014 at 05:49 AM. Reason: added info..
jecilop is offline   Reply With Quote
Old 09-03-2014, 07:01 AM   #4
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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by jecilop View Post
Next hurdle: Do you know a modification I could make to the Save to Disk "save template" that would force this also? I already having it printing the words using {#words:|(|words)} in case none are generated/exist for the type of entry.
I tested it after the comma 'fix', but it definitely isn't based on the appearance in Calibre - just the hard data.
{#words:,d|| words}
Quote:
Whoops!!! Turns out doing this affects using that column in a math function. Once the comma format is there, the simple math function (generating a custom page count) stopped working and returned an error.... Arrgh..
use "raw_field(#words)" instead of "field(words)" in the template that is doing the calculation.
Quote:
Interestingly, the comma shows in the book metadata jacket as desired when this code is applied. The tags or references are the same so it's curious that one shows commas and not the other.
It is arguably a bug that save-to-disk ignores the format spec. However, I am not going to change it because who knows how many templates that would break and the work around is easy.
chaley is offline   Reply With Quote
Old 09-03-2014, 06:22 PM   #5
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
SOLVED - thanks

Well, that's just clever. .


Tested and working
Thank You
Thank You
and did I mention...THANK YOU!?
jecilop is offline   Reply With Quote
Advert
Old 01-11-2023, 07:57 PM   #6
Brajbhushan
Junior Member
Brajbhushan began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2023
Device: none
Need help with similar problem

I have a custom column for number of Goodreads ratings. I would like the values to be displayed in comma separated format. I am not able to figure out the template to achieve the same. Here is the image of my column settings:
Attached Thumbnails
Click image for larger version

Name:	Goodreads Ratings.png
Views:	84
Size:	17.4 KB
ID:	198959  
Brajbhushan is offline   Reply With Quote
Old 01-11-2023, 08:22 PM   #7
Brajbhushan
Junior Member
Brajbhushan began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2023
Device: none
Solved

Quote:
Originally Posted by Brajbhushan View Post
I have a custom column for number of Goodreads ratings. I would like the values to be displayed in comma separated format. I am not able to figure out the template to achieve the same. Here is the image of my column settings:
I was able to solve it with following template:
{identifiers:,d:select(grvotes)}
Brajbhushan is offline   Reply With Quote
Reply

Tags
comma, custom column, format, solution


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Format for Numbers in Custom Column Lady Fitzgerald Library Management 5 09-16-2013 03:27 PM
Multiple comma separated values in custom column? silentguy Library Management 8 04-19-2011 05:10 AM
Custom Column - Book Format (ie mobi, epub etc) jphphotography Calibre 3 01-17-2011 12:34 AM
Custom Column Format aceflor Calibre 5 12-10-2010 10:28 AM
create custom format column blaubach Calibre 12 09-17-2010 03:22 PM


All times are GMT -4. The time now is 09:36 PM.


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