View Single Post
Old 08-19-2014, 01:18 PM   #20
MiniMouse
Groupie
MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.
 
MiniMouse's Avatar
 
Posts: 197
Karma: 318144
Join Date: Jul 2013
Location: Well, there will always be a big time delay because I'm not living in the US! And there could be some communication difficulties too because I'm not a native speaker!
Device: Sony PRS-T3S
Quote:
Originally Posted by chaley View Post
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
MiniMouse is offline   Reply With Quote