![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
Help with Icon Rule
Hi everyone.
I need some help with an advanced rule in the icons section. I have this rule already, but I need to add another column to it. Code:
program: test( or( contains(field('#ships'), "Angela Montenegro/Jack Hodgins", 'y', ''), contains(field('#ships'), "Temperance Brennan/Seeley Booth", 'y', ''), ), 'ships (crime).png', '' ) Is that possible? |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You can have as many "contains" lines as you want in the "or". Assuming you want the same icon if #readinglist contains interesting then just add a third "contains" to the "or".
If you want different a different icon for "interesting" then you should use "first_non_empty" instead of "or" and have the "contains" return the name of the icon instead of "y". Something like Code:
program: first_non_empty( contains(field('#ships'), "Angela Montenegro/Jack Hodgins", 'ships (crime).png', ''), contains(field('#ships'), "Temperance Brennan/Seeley Booth", 'ships (crime).png', ''), contains(field('#readinglist'), "interesting", 'someicon.png', '') ) |
![]() |
![]() |
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
Maybe I've not expressed myself correctly.
I need the rule to say if any of the following relationships AND on the reading list. not if any of the following relationships OR on the reading list. |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Something like
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', '' ) |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
The Reading List is a Text, but with a fixed set of permitted values.
|
![]() |
![]() |
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
I've tried the newest rule and the icon is still added to all the books on the "Interesting" Reading List, not just those with the relationship tags mentioned.
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
It works for me. I don't know why it doesn't work for you.
The first screen image shows what I tested. It checks an enum column for "def". If that exists then it checks my Genre column for various things, only one of which is ever there (comics). I see the icon only on books that match, as you can see in the screen capture. The text shown with the icon is a version of the template that returns the name of the PNG you are using. |
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
The reading list column is a Text, but with a fixed set of permitted values and my relationship column has a checkmark in contains names and it's a normal tag-column.
Does that make a difference? |
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,635
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
It shouldn't, the rule looks right. Could you get a screenshot of the rule... and the result in the library, where the fields are shown? Perhaps it can make clear the problem.
|
![]() |
![]() |
![]() |
#10 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Carefully check the parenthesis and commas in your expression. You can use the template tester (available in Preferences / Toolbars) to help debug. |
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
I have discovered the problem.
In my reading list I have 3 definitions: Uncertain,Interesting,Uninteresting. The icon rule also selects those stories on the Uninteresting list. |
![]() |
![]() |
![]() |
#12 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
contains(field('#readinglist'), '^interesting$', 'y', ''), |
|
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,635
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
That did the trick. Thanks both of you for the help.
|
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
If I wanted to use this rules on all the ships except those mentioned, what would the rule be then?
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |