View Single Post
Old 05-17-2014, 11:26 AM   #26
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 Tanjamuse View Post
That's okay I thank you for your help, I may return with other questions later
(for BR too ...)

Just for completeness and ignoring that this technique is quite technical, note that you can choose arbitrary combinations by using a custom rule.

In this example I used one tags-like custom column to hold the reading lists. In my debugging environment that column is named #mytextmult. I set up reading list to put "List1" into #mytextmult if the book is on List1 and "List2" into #mytextmult if the book is on List2.

The template for the custom rule checks the four combinations of interest:
  • A book is on both lists. Returns the color "green".
  • A book is on List1 only. Returns the color "red".
  • A book is on List2 only. Returns the color "blue".
  • A book is on neither list. Returns the color "yellow".
In all the cases the rule checks that the book is not on the device.

The sample template is:
Code:
program:
	l = field('#mytextmult');
	list1 = 'List1';
	list2 = 'List2';
	first_non_empty(
		test(	and(	not(ondevice()),
				str_in_list(l, ',', list1, '1', ''),
				str_in_list(l, ',', list2, '1', '')),
			'green',
			''),
		test(	and(	not(ondevice()),
				str_in_list(l, ',', list1, '1', ''),
				str_in_list(l, ',', list2, '', '1')),
			'red',
			''),
		test(	and(	not(ondevice()),
				str_in_list(l, ',', list1, '', '1'),
				str_in_list(l, ',', list2, '1', '')),
			'blue',
			''),
		test(	and(	not(ondevice()),
				str_in_list(l, ',', list1, '', '1'),
				str_in_list(l, ',', list2, '', '1')),
			'yellow',
			''),
	)
EDIT: changed the template to use variables for the values to look for in the list.

The attachment shows the results. In addition to putting the template into a coloring rule, I put the template into a custom composite column to make it easier to see the results.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.png
Views:	267
Size:	12.5 KB
ID:	123088  

Last edited by chaley; 05-17-2014 at 11:41 AM.
chaley is offline   Reply With Quote