|
|
#16 | |
|
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,705
Karma: 320245586
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
|
Quote:
In the dialog that appears, there's a field "Format for numbers" If your numbers are between 0 and 1 in progress, enter {:.0%} If your numbers are between 0 and 100, enter {:.0f}% And then when sorting the column it will sort correctly using the underlying number, but display as a nicely formatted percentage. |
|
|
|
|
|
|
#17 |
|
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Jan 2020
Device: none
|
Ok. But after I done that - I have a column where I need to manually enter the values. This dialog does not have a field for entering expression which will produce the value automatically.
|
|
|
|
| Advert | |
|
|
|
|
#18 |
|
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,705
Karma: 320245586
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
|
Ah - I had no idea that calibre had such a thing. I don't really use the bult-in viewer.
OK, change your column definition to have Code:
{id:reading_progress(, 'number')}
|
|
|
|
|
|
#19 | ||
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,350
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
Quote:
To create such a column, you do like explained by @pdurrant. As for the template I suggested. Proceed like this: 1) Open the 'Add your own columns' window 2) Select your 'Reading progress' column (the one that syncs with the Viewer) 3) Click the 'Edit' button on the right 4) In the 'Template' field, remove the standard template e copy/paste this: Code:
program:
format_number(reading_progress($id, '', 'pos_frac')*100, '{:.0f}')
6) Apply and restart |
||
|
|
|
|
|
#20 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 83,729
Karma: 153649587
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
|
|
|
| Advert | |
|
|
|
|
#21 | |
|
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Jan 2020
Device: none
|
Quote:
.... Ok, I see my mistake now. It should be really a one liner and word `program:` is essential. Code:
program: format_number(reading_progress($id, '', 'pos_frac')*100, '{:.0f}')
That expression should be mentioned in documentation, I think. |
|
|
|
|
|
|
#22 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,350
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
You could just copy and paste like I said. But you can also right click the template field and open the Template Editor, in case you need to create more complex templates. I always use the editor, so that's why the code I send had two lines. Also, you will be able to see all the functions available (plus documentation) and test your template as you type.
|
|
|
|
|
|
#23 |
|
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Jan 2020
Device: none
|
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sort by author and then publish date (multi-column sort)? | badbob001 | Library Management | 7 | 07-22-2020 06:45 PM |
| Trying to make a percentage progress composit column. | Kythe42 | Library Management | 13 | 12-26-2019 05:14 PM |
| Column built from other column : Mark read if evaluated | Cmely | Library Management | 1 | 02-26-2017 09:07 AM |
| Manual Sort or Sort by custom column | Dethmaul | Marvin | 2 | 04-28-2014 11:54 AM |
| Multi column sort? | nexus100 | Calibre | 1 | 07-11-2010 11:19 PM |