Quote:
Originally Posted by rifka
How do I get the Icons field to recognize greater than, less than, and equal to. I have discover that:
if the NUMBER column IS <1 doesn't work.
|
Finally had some time to look at this.
Rather than continuing to add special purpose rule types, I bit the bullet and added "advanced rules" for column icons. This kind of rule already existed for column colors. An advanced rule is a
general program mode template that should return the name of the icon file to use or the empty string if no icon is to be used. This kind of rule allows arbitrary rules, subject to the ability to express the rule in the template language.
The following is an example of a (rather silly) rule that chooses between two icons based on whether the author's name contains the word "weber".
Code:
program:
a = field('authors');
contains(a, 'weber', 'arrow-down.png', 'catalog.png')
One can write a rule that chooses between three icons based on whether a value is less than something, equal to that something, or greater than that something. Assuming that the "something" is 2, then an example of the rule would be
Code:
program:
a = field('#myNumber');
cmp(a, 2, 'arrow-down.png', 'catalog.png', 'debug.png')