Quote:
Originally Posted by ilovejedd
A custom column is what I meant by "better to have a placeholder for file size". My main question was whether I need one custom column or two.
e.g.
#epub_size (int) - {:'select(formats_sizes(),'EPUB')'} set via bulk s&r
then number formatting done via display formats option (is that doable?)
or
#epub_size (int) - {:'select(formats_sizes(),'EPUB')'} set via bulk s&r
#size (composite) - {#epub_size:human_readable()}
|
The number formatter used in numeric custom columns cannot generate a "human readable" string, nor can it divide by 1000. It can add commas and the like. From what you say, this isn't what you want.
You can easily do it with two columns, one containing the value and the other a composite column (built from other columns) that formats the number as you wish, doing any arithmetic needed. The first column can be precomputed or also be a composite column that fetches the data on demand.
You can do it in one composite column in general program mode, fetching the value then formatting it.
You can do it in one composite column where the value to be formatted is precomputed and inserted into the template. How and when you fetch the number to insert into the template is up to you. I think there are two practical possibilities:
- Use bulk search/replace to update the column for each book. Advantage: easy to set up. Disadvantages: you must remember to run it and it will update last_modified for every book.
- Use something like the Save Virtual Libraries To Column library-closed plugin. The plugin would compute the appropriate template string for each book then check if the new template equals the existing one. If it does not, update the book. Advantages: the last_modified date isn't updated unless something changes, and the values are automatically updated from time to time. Disadvantage: the values for new/changed books will be wrong until you close and reopent the library.
You could also do it in two columns using the above methods, where the precompute cycle stores the number.
Finally, you can do it in one numeric custom column using the above methods, where the precompute cycle does the appropriate arithmetic so the format string will be able to display the number (probably divide by 1000).