| 
 | |||||||
|  | 
|  | Thread Tools | Search this Thread | 
|  08-31-2014, 04:11 AM | #1 | 
| Addict            Posts: 260 Karma: 139980 Join Date: Mar 2014 Device: Android | 
				
				REQ: Template for custom column to calc # of Pgs based on traditional counts
			 
			
			UPDATE: See solution as of post #13 on 9/2. ORIGINAL POST: I've looked through this info. I've managed with some of it, but this part is beyond me right now. I think I can handle making the column, but I need the FUNCTION string to make it work. My goal is do a math problem using 1 existing custom column. I have these 2 columns: #pages and #words These are populated by the Count Pages plug-in. However, #pages uses characters to determine the number of pages. I want to be be able to relate to the digital book better based on traditional formatting of printed non-educational and non-art books sized between 5.5in to 6"x9" in English. I've researched many "facts" and opinions on the average number of words per pages in these traditional printed formats. I've settle on using 300 words per page as my number to determine a page count I can relate to. I'm already familiar with personal reading speed and can relate that to word count, but this would be a really nice feature if someone can help make it happen. It could also be really helpful to self-publishers. Essentially, I need a column that does this math: #words/300 and returns the numeric value rounded up if possible. Can anyone construct this string for my custom column? Last edited by jecilop; 09-02-2014 at 03:15 AM. Reason: Update | 
|   |   | 
|  08-31-2014, 01:01 PM | #2 | 
| Well trained by Cats            Posts: 31,249 Karma: 61360164 Join Date: Aug 2009 Location: The Central Coast of California Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A | 
			
			Zoom level 9 on my PEz: 13 words (as typed, no set length) fit on the screen. <rant> When are folk going to give up on old school, fixed layout, printed page counts? Visible character counts divided by constant 'word size' divided by a constant 'words per page' is a close as you probably will get to a pages of FIXED sized print. Nothing else is going to be close without the CURRENT device CURRENT settings available. </rant> | 
|   |   | 
| Advert | |
|  | 
|  08-31-2014, 02:19 PM | #3 | 
| Addict            Posts: 260 Karma: 139980 Join Date: Mar 2014 Device: Android | 
			
			I'm going to choose not to take offense and assume you actually read the entire request and just missed the point... This is FOR ME. This is not a dig or complete dissatisfaction with hee character to pages conversion. I change my reader size often and know that it is almost irrelevant in a digital reader age. This is a RELATABLE number I seek. It's like being a kid and seeing first how thick the book is and then looking at the word size and line spacing..... As a long time reader, I have a good feel for the size of the books mentioned and how long the type of read is based on that printing and the time and appropriate times I can devote to it. I have gotten much better at this based on word count and knowing my reading speeds. STILL, it is a QUICK and RELATABLE NUMBER. It's like English vs. metric systems. I know the math and can do the conversions. But appx 4.8km's isn't as relatable to me as 3 miles. POINT OF VIEW matters. For those who know this coding far better than I do or can figure out despite my lone attempts, I appreciate their help on what seems like a simple thing for them from which I will learn. I can play with and modify as needed. I will also learn from having an active string and can get better at it myself. I did my homework thoroughly before posting this request. Forums are informative, but requests for me are last case scenarios. Replies are only when I really know an answer or think I can be helpful. I prefer to think before I post. Last edited by jecilop; 08-31-2014 at 02:22 PM. | 
|   |   | 
|  09-01-2014, 12:35 AM | #4 | 
| Ex-Helpdesk Junkie            Posts: 19,421 Karma: 85400180 Join Date: Nov 2012 Location: The Beaten Path, USA, Roundworld, This Side of Infinity Device: Kindle Touch fw5.3.7 (Wifi only) | Code: program:
int(field('#words'))/300 | 
|   |   | 
|  09-01-2014, 09:15 PM | #5 | 
| Addict            Posts: 260 Karma: 139980 Join Date: Mar 2014 Device: Android | 
				
				Still not working...further help needed.
			 
			
			Well @eschwartz, I appreciate your help, but I'm apparently completely confused as to how to make the custom column and make this work in it. Any advice? Below is what I've done and a picture of the latest thing I've tried. I'm using "column built from other columns". All I get is errors returned in the column or whatever I enter as my "formula" showing in the cell. I'm confused now. I've looked  through the Calibre Template Language page and am now overwhelmed after all of that info and my varied attempts and they are many!!!!  Can you help and provide the correct full string? | 
|   |   | 
| Advert | |
|  | 
|  09-01-2014, 09:28 PM | #6 | 
| Well trained by Cats            Posts: 31,249 Karma: 61360164 Join Date: Aug 2009 Location: The Central Coast of California Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A | 
			
			#words is the assumed field name of the results from running the Count Pages PI that you want to further process into YOUR column
		 | 
|   |   | 
|  09-01-2014, 10:32 PM | #7 | 
| Grand Sorcerer            Posts: 13,693 Karma: 79983758 Join Date: Nov 2007 Location: Toronto Device: Libra H2O, Libra Colour | 
			
			Try entering in this for the template Code: program: format_number(divide(field('#words'),300),"{0:5.0f}") | 
|   |   | 
|  09-01-2014, 10:43 PM | #8 | 
| Ex-Helpdesk Junkie            Posts: 19,421 Karma: 85400180 Join Date: Nov 2012 Location: The Beaten Path, USA, Roundworld, This Side of Infinity Device: Kindle Touch fw5.3.7 (Wifi only) |  general program mode in calibre != python programs  "program:" is how you begin a template in general program mode. copy-paste the whole code box as given, for the template. I don't think we need to format the number here... so here is a simpler one: Code: program:
divide(field('#words'),300) | 
|   |   | 
|  09-01-2014, 11:33 PM | #9 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 Join Date: Mar 2012 Location: Sydney Australia Device: none | 
			
			This thread has been in the wrong sub-forum for several days, someone searching for custom column related threads is unlikely to search in the recipe sub forum BR | 
|   |   | 
|  09-01-2014, 11:50 PM | #10 | 
| Ex-Helpdesk Junkie            Posts: 19,421 Karma: 85400180 Join Date: Nov 2012 Location: The Beaten Path, USA, Roundworld, This Side of Infinity Device: Kindle Touch fw5.3.7 (Wifi only) | |
|   |   | 
|  09-02-2014, 12:15 AM | #11 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 Join Date: Mar 2012 Location: Sydney Australia Device: none | |
|   |   | 
|  09-02-2014, 12:17 AM | #12 | 
| Ex-Helpdesk Junkie            Posts: 19,421 Karma: 85400180 Join Date: Nov 2012 Location: The Beaten Path, USA, Roundworld, This Side of Infinity Device: Kindle Touch fw5.3.7 (Wifi only) | |
|   |   | 
|  09-02-2014, 02:00 AM | #13 | 
| Addict            Posts: 260 Karma: 139980 Join Date: Mar 2014 Device: Android | 
				
				Solved!!! and various uses for those who may do this also.
			 
			
			@theducks, I'm not sure if that's a statement or a question. As mentioned before, #words is the lookup name of the referenced column. I'm aware of that. It is accurate. @PeterT, THANK YOU!!!!  That did it. Now I can play with that as needed and change the math or make more columns based on reader familiarity like kids' books vs. adults. FWIW, Getting some kids to read digitally is actually tough as they want to compare it to books they feel "confident" about finishing because of the typical printed format. It helps them relate also.  Kids---novel style typically 250 to 300 words per page or less (just review some of your kids' books) Adult - novel style 325-400 words per page (ex: Dean Koontz paperback) These are based on actual word counts in multiple books running 4"x7", 5"x8", and 6"x9" with various target audiences and margins and page breaks and line spacing.... I looked over about 10 paperback books with which I'm very familiar and compared typesets and such and word counts to pages since I also have digital copies. The math I'm using works out very well and gives me a good feel for the book "thickness" compared to 4x7 paperbacks with compressed, tightly fitted words and small margins and such which is my preference and seen in most novel paperbacks. 370 turned out to be a good number!. I even tried it on a digital copy of Anne of Avonlea compared to printed and it worked well. This was a BIG help!  I'm including a picture of the custom column screen for anyone else who wants to set theirs up including some self-publishers who need to determine this kind of information. This picture is based on 370words/pg as above. I used exactly this in the template field: program: format_number(divide(field('#words'),370),"{0:5.0f }") Last edited by jecilop; 09-02-2014 at 02:09 AM. Reason: jibberish typos | 
|   |   | 
|  09-02-2014, 02:18 AM | #14 | 
| Addict            Posts: 260 Karma: 139980 Join Date: Mar 2014 Device: Android | 
			
			@BetterRed I just started the thread yesterday the 31st. Today (your post) is one day later...It hasn't "been here for several days". Also, this the the best I knew AFTER LOOKING THROUGH THINGS ABOUT CUSTOMIZING columns and what I thought Recipe meant. If you know a better place and how to get it there, please, let me know. | 
|   |   | 
|  09-02-2014, 07:29 AM | #15 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 Join Date: Mar 2012 Location: Sydney Australia Device: none | 
			
			@jecilop - recipes are about downloading from  news sites But as you're a new member, I cannot expect you to have intimate knowledge of each sub-forum, besides which its easy to inadvertently start a thread in the 'wrong' sub-forum. That's one of the things that moderators get paid for, moving threads to their rightful place  . The time you see on a post is your wall time, the time I see is my wall time, because its not a flat earth what to you looks like yesterday, looks like the day before where I am, I'm 10 hours ahead of UTC, 14 ahead of NYC and 17 ahead of LA. Its almost Wednesday here  BR | 
|   |   | 
|  | 
| Tags | 
| custom column, math function, page count, solved | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Custom Column with sub-folder template | Tanjamuse | Library Management | 6 | 01-13-2014 12:22 AM | 
| Template for custom column | BeeTee-Ess | Library Management | 5 | 10-04-2013 08:55 PM | 
| Custom column returns value based on value of another custom column? | calvin-c | Calibre | 3 | 09-14-2013 02:24 PM | 
| [Custom Column - Composite] Template Help Requested | Ealdwulf | Library Management | 2 | 06-16-2012 04:58 AM | 
| Help with template for custom column from tags | africalass | Library Management | 2 | 07-16-2011 11:47 AM |