Quote:
Originally Posted by chaley
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', '', '')
)
|
I think I'm a bit stupid here
Could you explain to me what to put where in the advanced rule? Because I never worked with it before
But I would really like to know
Mini