View Single Post
Old 06-05-2016, 12:17 PM   #6
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: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Joanna View Post
One more question: I realized that for a couple of books (audiobooks, in fact) I don't have the number of pages entered. How to get 'blank' results for those books? I.e. how to have something similar to your
Code:
test(progress, pagesread, '');
but checking the content of two columns: #progress and #pages (and if either of them - or both - is empty, render a blank composite column)?
There are several ways to deal with this.

One complexity: raw_field distinguishes between empty fields and fields containing an empty value by returning the string "None" in the first case. This matters because the value for #pages is now fetched using raw_field.

The easiest solution is to check #pages in the first argument to "test", but this would need to be done using "field" instead of "raw_field". Something like:
Code:
program:
	progress = field('#myint2');
	left = subtract(100, progress);
	percent = divide(left, 100);
	pagesleft = multiply(percent, raw_field('#myint'));
	test(and(progress, field('#myint')), pagesleft, '');
where as before, #myint and #myint2 stand in for your columns. The "and" checks that both progress and #myint are empty. Note that I use "field" instead of "raw_field" so that undefined turns into the empty string.
Quote:
I'm pretty sure the sorting doesn't work, though. Are you absolutely sure it works for you? Based on the screenshot, it looks like it certainly does but theoretically, you could have sorted on myint first, by coincidence, and then the order would not have had to change.
Nope, that isn't it. I sorted by author then the composite column (column built from other columns) and it works fine.

Be sure that you are running the latest calibre. There were some problems with sorting in the mid calibre 2 releases.

If you wish I am willing to look at your metadata.db to see if I can determine why it isn't sorting. Zip it up and send it to calibre2 at charles dot haleys dot org. Send only the metadata.db, not the library. Note that I will see the contents of your library. If that is a problem (and I can imagine that it might be) then don't send it.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.png
Views:	674
Size:	23.5 KB
ID:	149227  
chaley is offline   Reply With Quote