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 05-15-2020, 11:14 AM   #856
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
thank you for your help

I have the file name and asin. I have no clue how to do result. but i do have one other problem. The file names all have _ebok on the end. This will result in all of the compares resulting in no. Any idea for a work around?
LibBikher is offline   Reply With Quote
Old 05-15-2020, 02:38 PM   #857
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
I have been fighting with this all afternoon. I figured out the file name issue but i cant make the custom column work.

Lookup Name: results
Column Heading: Results
Column Type: Column built from other columns
Template: {results: strcmp(#asin, #file, yes, no, na)}

But it doesn't work. What am I doing wrong?
Please help
LibBikher is offline   Reply With Quote
Advert
Old 05-16-2020, 05:21 AM   #858
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by LibBikher View Post
I have been fighting with this all afternoon. I figured out the file name issue but i cant make the custom column work.

Lookup Name: results
Column Heading: Results
Column Type: Column built from other columns
Template: {results: strcmp(#asin, #file, yes, no, na)}

But it doesn't work. What am I doing wrong?
The template can't reference the column it is for. Try:

Code:
{#asin:strcmp(#file, yes, no, na)}
davidfor is offline   Reply With Quote
Old 05-16-2020, 08:18 PM   #859
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
Thank you for your help. The equation works but isn't returning accurate results. Even though the asin and file name match its returning na NA should only come up if one or both fields are empty.

I've attached snapshots Im not sure why this is so difficult
Attached Thumbnails
Click image for larger version

Name:	asin.jpg
Views:	823
Size:	34.0 KB
ID:	179283   Click image for larger version

Name:	file.jpg
Views:	851
Size:	29.1 KB
ID:	179284   Click image for larger version

Name:	results.jpg
Views:	852
Size:	36.7 KB
ID:	179285   Click image for larger version

Name:	snap.jpg
Views:	829
Size:	16.7 KB
ID:	179286  
LibBikher is offline   Reply With Quote
Old 05-16-2020, 08:45 PM   #860
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,638
Karma: 29710510
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by LibBikher View Post
Thank you for your help. The equation works but isn't returning accurate results. Even though the asin and file name match its returning na NA should only come up if one or both fields are empty.

I've attached snapshots Im not sure why this is so difficult
Try changing 'file' to:

Click image for larger version

Name:	Annotation 2020-05-17 104350.jpg
Views:	869
Size:	42.8 KB
ID:	179287

BR
BetterRed is offline   Reply With Quote
Advert
Old 05-17-2020, 02:35 AM   #861
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by LibBikher View Post
Thank you for your help. The equation works but isn't returning accurate results. Even though the asin and file name match its returning na NA should only come up if one or both fields are empty.

I've attached snapshots Im not sure why this is so difficult
That could be a formatting issue as @BetterRed suggested. But, I think I would do the template as:

Code:
program:
strcmp(raw_field('#asin'), raw_field('#file'), 'yes', 'no', 'na');
That should prevent issues with how the data is formatted for display.
davidfor is offline   Reply With Quote
Old 05-17-2020, 02:35 PM   #862
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
BetterRed I was still getting na even though they matched

davidfor I tried your suggestion:
template: {#asin:strcmp(raw_field('#asin'), raw_field('#file'), 'yes', 'no', 'na')}
error: TEMPLATE ERROR: incorrect number of arguments for strcmp
LibBikher is offline   Reply With Quote
Old 05-17-2020, 05:21 PM   #863
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,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by LibBikher View Post
BetterRed I was still getting na even though they matched

davidfor I tried your suggestion:
template: {#asin:strcmp(raw_field('#asin'), raw_field('#file'), 'yes', 'no', 'na')}
error: TEMPLATE ERROR: incorrect number of arguments for strcmp
You didn't actually try what he suggested. Try the 2 lines of code *exactly* as he wrote it, including the word "program". Note that there are not any curly braces in his suggestion.
chaley is offline   Reply With Quote
Old 05-17-2020, 06:20 PM   #864
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
i didn't know I could put the word program in there. OK done. Now it is returning NO even though they match. Is it possible that this is because I am using the GetFileName plugin to get the file name and extract the extension? So that even though I cant see the file extension in the File column, the system still does?
Attached Thumbnails
Click image for larger version

Name:	snap2.JPG
Views:	870
Size:	16.2 KB
ID:	179296  
LibBikher is offline   Reply With Quote
Old 05-17-2020, 06:30 PM   #865
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,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by LibBikher View Post
i didn't know I could put the word program in there. OK done. Now it is returning NO even though they match. Is it possible that this is because I am using the GetFileName plugin to get the file name and extract the extension? So that even though I cant see the file extension in the File column, the system still does?
davidfor's template says that "no" is the correct answer if the values match. To be precise, the template says
  • return "yes" if #asin is lexicographically less than #file'
  • return "no" if #asin equals #file'
  • return "na" if #asin is lexicographically greater than #file'
I confess that I can't figure out what you really want to happen so I can't suggest changes.
chaley is offline   Reply With Quote
Old 05-17-2020, 07:39 PM   #866
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
ok so it is working. What i am looking for is:

return "yes" if #asin = #file
return "no" if #asin ≠ #file
return "na" if #asin or #file is empty
LibBikher is offline   Reply With Quote
Old 05-18-2020, 07:00 AM   #867
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,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by LibBikher View Post
ok so it is working. What i am looking for is:

return "yes" if #asin = #file
return "no" if #asin ≠ #file
return "na" if #asin or #file is empty
Try this
Code:
program:
	asin = raw_field('#enum2');
	file = raw_field('#enum2');
	first_non_empty (
		strcmp(file, 'None',  '', 'na', ''),
		strcmp(asin, 'None',  '', 'na', ''),
		strcmp(file, asin, 'no', 'yes', 'no')
	)
Note that it won't work if file or asin can ever be the word "None".
chaley is offline   Reply With Quote
Old 05-18-2020, 10:17 AM   #868
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
Chaley I copied and pasted that directly into the template field for the results column and everything came back NA
LibBikher is offline   Reply With Quote
Old 05-18-2020, 10:21 AM   #869
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,342
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by LibBikher View Post
Chaley I copied and pasted that directly into the template field for the results column and everything came back NA
Did you change the lookup keys in the first two lines to those in your database? E.g.
Code:
asin = raw_field('#asin');
file = raw_field('#file');
chaley is offline   Reply With Quote
Old 05-18-2020, 01:05 PM   #870
LibBikher
Junior Member
LibBikher began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2015
Device: iPad mini with kindle app
IT WORKS!!!! Thank you everyone for your help.
LibBikher is offline   Reply With Quote
Reply

Tags
custom column, tag, tags


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom column i need a little help shinken Calibre 3 09-15-2010 03:41 AM
Using Custom Metadata in Save Template EJvdH Calibre 1 07-02-2010 06:06 AM
Accessories Decalgirl Kindle 2 custom skin template srmalloy Amazon Kindle 6 04-09-2010 09:55 PM
Donations for Custom Recipes ddavtian Calibre 5 01-23-2010 04:54 PM
Help understanding custom recipes andersent Calibre 0 12-17-2009 02:37 PM


All times are GMT -4. The time now is 04:55 PM.


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