Thanks, chaley!
I think I understand the reasons behind each of the changes you made to the rule. I do have one other question. The new rule does what I was looking for but with one minor glitch, which is my fault.
I have a few sets of tags which are associated with the same icon:
tag2 & tag8 = letter-c-icon.png
tag3 & tag4 = letter-b-icon.png
tag6 & tag14 = letter-x-icon.png
tag9 & tag10 = letter-p-icon.png
tag12 & tag13 = letter-s-icon.png
Which I'm realizing is about half the tags in the rule. Anyway I use them as warnings, for example tag2 and tag8 are cheating and infidelity respectively, so they're essentially the same thing but some stories have one tag and some stories have the other tag. What I didn't take into account are stories which have both tags so I end up with the C icon twice.
So I did a little searching and found this forum
thread and I think the Or function is what I want to incorporate but I'm not sure how or if I'm better off setting each pair up as a separate rule.
I tried setting it up this way:
Code:
program:
t = field('tags');
strcat
(
contains(t, "tag1", 'letter-a-icon.png:', ''),
contains(t, "tag3", 'letter-b-icon.png:', ''),
contains(t, "tag4", 'letter-b-icon.png:', ''),
contains(t, "tag5", 'letter-d-icon.png:', ''),
contains(t, "tag6", 'letter-x-icon.png:', ''),
contains(t, "tag7", 'letter-i-icon.png:', ''),
contains(t, "tag9", 'letter-p-icon.png:', ''),
contains(t, "tag10", 'letter-p-icon.png:', ''),
contains(t, "tag11", 'letter-r-icon.png:', ''),
contains(t, "tag12", 'letter-s-icon.png:', ''),
contains(t, "tag13", 'letter-s-icon.png:', ''),
contains(t, "tag14", 'letter-x-icon.png:', ''),
contains(t, "tag15", 'letter-w-icon.png:', ''),
or(
contains(t, "tag2", 'y', ''),
contains(t, "tag8", 'y', ''),
),
'letter-c-icon.png:',
''
)
Only that added the C icon to
every book and not just the ones with tag2 and/or tag8. Switching Strcat to Test gave me an Exception error and I assume switching to First_non-empty will give me the same issue I originally had.
When I set it up as a separate rule
Code:
program:
t = field('tags');
test(
or(
contains(t, "cheating", 'y', ''),
contains(t, "infidelity", 'y', ''),
),
'letter-c-icon.png',
''
)
It works perfectly.
So I'm wondering if I should set each one up separately or if I'll have to worry about it bogging down Calibre? Thanks again for the help.