Mobileread
Composite Column based on Multiple Criteria
#1  tamarissa 11-12-2019, 01:15 AM
I'm looking to create a custom column based on information from 2 other columns. The end result I'm looking for is:

IF Column A (#keep_read) = "Yes" & Column B (#read_status) = "N",
THEN Column C (#send_kobo) = "Yes"
ELSE Column C (#send_kobo) = "No"

I can't figure out how to adapt any of the "If-then-else" formulas for multiple columns . Or maybe there's a better option; as along as it works!
Reply 

#2  chaley 11-12-2019, 09:35 AM
Try this
Code
program:	strcmp(	field('#keep_read'), 'yes',	'No',	strcmp(	field('#read_status'), 'N',	'No',	'Yes',	'No'),	'No')
This one works too.
Code
program:	test(	and(	strcmp(field('#keep_read'), 'yes', '', 1, ''),	strcmp(field('#read_status'), 'N', '', 1, '')	),	'Yes',	'No');
Reply 

#3  tamarissa 11-12-2019, 11:20 AM
Thanks, but I tried both of those and they both resulted in a template error.
Reply 

#4  chaley 11-12-2019, 11:25 AM
Quote tamarissa
Thanks, but I tried both of those and they both resulted in a template error.
They both work for me.
  1. Check that the column names are spelled correctly.
  2. Check the parentheses.
  3. Don't put any other characters in the template.
  4. Ensure that the keyword "program" is at the absolute beginning of the template.
  5. Do not intermix {...} templates with "program mode" templates.
  6. Post exactly what you tried.
Reply 

#5  chaley 11-12-2019, 11:31 AM
Also, use the "Template Tester" to debug the template. The process goes much faster. Put the tester on the main library context menu (Preferences / Toolbars & menus / The context menu for books in the calibre library.
Reply 

#6  tamarissa 11-12-2019, 07:01 PM
I did get it work, shut everything down and restarted; it seemed to be fine. However, it doesn't do what it says it should; for example, there are multiple books that have the Read Status column = "N" that should say have the new column say "yes", but actually says "no'.
Reply 

#7  chaley 11-12-2019, 07:06 PM
Quote tamarissa
Where is the template tester? I don't see anywhere in the program, and google that didn't provide any further information.
You get the template tester into the main library context menu in the way I said in my last post.
Quote
Also, use the "Template Tester" to debug the template. The process goes much faster. Put the tester on the main library context menu (Preferences / Toolbars & menus / The context menu for books in the calibre library.
Then when you right click on a book, one option presented to you will be the template tester.
Reply 

#8  tamarissa 11-12-2019, 07:24 PM
See Screenshot:
Screen Shot 2019-11-12 at 4.18.42 PM.png 
Reply 

#9  tamarissa 11-12-2019, 07:30 PM
There are also books that in the Keep Read column say yes, but it still says no in new column.
Screen Shot 2019-11-12 at 4.18.42 PM.png 
Reply 

#10  tamarissa 11-12-2019, 07:34 PM
I've just confirmed this with both options; the only result provided is "No".
Screen Shot 2019-11-12 at 4.28.46 PM.png 
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register