04-21-2017, 03:41 PM | #1 |
Member
Posts: 15
Karma: 10
Join Date: Feb 2017
Device: Kobo Glo
|
How to set the number of decimals in a custom column
I have setup a column to evaluate the approximate time required to read a given book, it is a column generated from other columns, and it is based on the word count.
This is what I have done right now: {#hours:'divide(field('#words'), 250)'} it works fine, except that I'd like to remove or set a limited number of decimals; having this column say that I need 15 hours makes sense, I don't really need to know that it really is 15.632643 |
04-21-2017, 05:40 PM | #2 | |
null operator (he/him)
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Useful link ==>> Python String Format Cookbook BR Last edited by BetterRed; 04-21-2017 at 06:35 PM. |
|
04-22-2017, 06:31 AM | #3 |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Use something like
Code:
program: format_number(divide(raw_field('#words'), 250), '{:0.2f}') |
04-28-2017, 09:06 AM | #4 |
Member
Posts: 15
Karma: 10
Join Date: Feb 2017
Device: Kobo Glo
|
Thank you for the suggestions!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Column for Folder Name AND Number?? | kksdragons | Library Management | 9 | 08-23-2016 10:05 AM |
Set Custom Column from identify.py | ahisham | Development | 6 | 02-05-2015 09:53 AM |
Custom column to display number of chapters? | crackshot91 | Library Management | 10 | 09-08-2012 04:56 PM |
Automatically set custom column when fetching news | bork | Library Management | 1 | 04-14-2012 03:20 AM |
Using OnDevice to set the value of a custom column | WendyR14 | Library Management | 3 | 10-23-2011 08:03 PM |