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 10-13-2016, 03:18 PM   #16
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
Quote:
Originally Posted by Tanjamuse View Post
If I wanted to use this rules on all the ships except those mentioned, what would the rule be then?
Read the documentation of the test function. It lets you give a response for either or both of non-empty or empty.

For example:
Code:
program:
	test(
		and(
			contains(field('#readinglist'), 'interesting', 'y', ''),
			or(
				contains(field('#ships'), "Angela Montenegro/Jack Hodgins", 'y', ''),
				contains(field('#ships'), "Temperance Brennan/Seeley Booth", 'y', '')
			)
		),
		'',
		'ships (crime).png'
)
shows a ship icon when none of the conditions are true. This
Code:
program:
	test(
		and(
			contains(field('#readinglist'), 'interesting', 'y', ''),
			or(
				contains(field('#ships'), "Angela Montenegro/Jack Hodgins", 'y', ''),
				contains(field('#ships'), "Temperance Brennan/Seeley Booth", 'y', '')
			)
		),
		'ships (crime).png',
		'sinking ships (crime).png'
)
shows a ship icon if the conditions match and a sinking ship icon if they don't.
chaley is offline   Reply With Quote
Old 10-13-2016, 03:25 PM   #17
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
Thanks, I thought it was something like changing the Y in the lines to a N.

Is it possible to combine these two rules as well:


Code:
program:
	test(
		and(
			contains(field('#readinglist'), '^interesting$', 'y', ''),
			or(
				contains(field('#ships'), "Angela Montenegro/Jack Hodgins", 'y', ''),
				contains(field('#ships'), "Temperance Brennan/Seeley Booth", 'y', '')
			),
		),
		'ships (crime).png',
		''
)
with this one:

Code:
program:
	test(
		and(
			contains(field('#reading_list'), 'interesting', 'y', ''),
			or(
				contains(field('#ships'), "Angela Montenegro/Jack Hodgins", 'y', ''),
				contains(field('#ships'), "Temperance Brennan/Seeley Booth", 'y', '')
			)
		),
		'ships (crime).png',
		'never.png'
)
Thanks
Tanjamuse is offline   Reply With Quote
Advert
Old 10-13-2016, 03:30 PM   #18
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
As far as I can see the only differences are the removal of the anchors on the "interesting" line and the addition of the alternate icon.

If you really meant to remove the anchors then the only way to combine the two rules is to use first_non_empty with the separate rule sets. Best would be to set some variable to the result of the "contains" tests so you don't recalculate them.

I am out of time so I must leave it to you to work out how to do it.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
One File to Rule Them All ? storax Workshop 3 08-14-2013 08:12 PM
One device to rule them all BeccaPrice General Discussions 95 08-17-2012 06:15 AM
The 5 finger rule. AlexGrama General Discussions 73 02-26-2012 05:19 AM
ID: Rule Above and Below dezignlady ePub 5 07-12-2011 11:40 PM
Will One Device Rule Them All... Or Not thymaster General Discussions 65 11-23-2010 01:19 PM


All times are GMT -4. The time now is 02:02 AM.


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