Thread: Custom Coloring
View Single Post
Old 07-02-2011, 03:51 AM   #82
mezme
Connoisseur
mezme began at the beginning.
 
Posts: 59
Karma: 10
Join Date: Dec 2009
Device: PRS700
Okay... I've pretty much got the coloring working the way I want it... with a few "exceptions" that I cannot figure out. Help?

Basically this is what I'm wanting to happen:
If rating = 5 then rating is silver
else if format is false then rating is red
else if comments are false then rating is fuchsia
else if cover is false then rating is fuchsia
else rating is black (format=true / cover=true / comments=true)

The code I am using right now is:
switch(field('rating'), '5',
'silver',
test(field('format'),
test(first_non_empty(field('comments'),field('cove r')),
'black',
'fuchsia'),
'red')
)

This code DOES work for the following conditions:
if rating = 5 then rating is silver
if there is no format then rating is red
if cover is true and comments are false then rating is fuchsia
if cover and comments are false then rating is fuchsia

Error occures here:
if cover is false and comments are true then rating is black
.... when it should be fuchsia

It appears to not be recognizing when the cover is true/false and is only registering the comments.


On a side note... I did try the following to see if it made a difference testing comments and cover seperately... the result was that if the first two conditions (format=false or rating=5) were not met then rating became fuchsia regardless of whether comments where true/false or cover was true/false.

switch(field('rating'), '5', 'silver',
test(field('format'),
test(first_non_empty(field('comments')),
test(first_non_empty(field('cover')),
'black',
'fuchsia'),
'fuchsia'),
'red')
)
mezme is offline   Reply With Quote