Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 07-07-2020, 09:15 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Red face Help with a composite column

I've been reading over the template language page over and over but I'm not having much luck understanding what to do.

I have two columns, #read (yes/no) and #lastread (date). I was trying to make a composite #currentlyreading column that returns a yes/true result if #read:false and #lastread is set to anything. (I'd like to use it for sorting my currently-reading books to the top of the list in View Manager.)

I was trying to use the check_yes_no and if not empty but all my results either got strings of code or template errors appearing in the composite column.
ownedbycats is online now   Reply With Quote
Old 07-08-2020, 03:46 AM   #2
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Use the template
Code:
program: 
	test(check_yes_no('#mybool', 0, 1, 0),  test(field('#mydate'), 'Yes', ''), '')
Be sure to change the lookup keys to the ones in your database.

Note that this template returns "Yes" or empty. If you want "No" then change the empty strings ('') to 'No'. You can also distinguish between the Yes/No column set to False when there is no date by changing only the first ''.

You might want to check the box "Show checkmarks" in the definition of your composite column.
chaley is offline   Reply With Quote
Advert
Old 07-08-2020, 10:06 AM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
It works!

I changed #read to 1, 1, 0 so that it also gets undefined states (I don't use the tristate y/n columns, so a non-set one displays as 'no') and it works well.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with composite column BookJunkieLI Library Management 2 07-03-2019 11:42 AM
Composite Column BetterRed Calibre 12 09-01-2013 04:58 AM
Set value of another column from composite? dirgeon Library Management 1 02-03-2013 11:40 AM
Composite column or not ? Bertrand Library Management 3 08-24-2011 01:27 AM
Custom Composite Column silentguy Calibre 4 11-24-2010 10:28 AM


All times are GMT -4. The time now is 05:59 PM.


MobileRead.com is a privately owned, operated and funded community.