Quote:
Originally Posted by MiniMouse
This is for everyone who wants a 1/2 rating for 3+ and 4+ because sure I did. AND so I created one 
|
Using an advanced rule instead of a sequence of basic rules would have better performance. It is also easier to customize for more or fewer cases.
An example template for an advanced icon rule that returns the name of the desired png file is:
Code:
program:
# Set r to the value in a float field containing the rating
r = raw_field('#myfloat');
# Return the name of the png that corresponds to the value. The .01 stuff
# is used to avoid having to enter the png name twice, once for less-than
# and once for equals
first_non_empty(
cmp(r, 1.01, '1-star-rating.png', '', ''),
cmp(r, 2.01, '2-star-rating.png', '', ''),
cmp(r, 3.01, '3-star-rating.png', '', ''),
cmp(r, 3.51, '3-star-plus-rating.png', '', ''),
cmp(r, 4.01, '4-star-rating.png', '', ''),
cmp(r, 4.51, '4-star-plus-rating.png', '', ''),
cmp(r, 5.01, '5-star-rating.png', '', '')
)