View Single Post
Old 10-25-2014, 11:24 AM   #19
Nyssa
Series Addict
Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.Nyssa ought to be getting tired of karma fortunes by now.
 
Nyssa's Avatar
 
Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
Quote:
Originally Posted by chaley View Post
You are correct. Empty is considered to be zero.

You can get around this by using an advanced rule that can check if the column is empty before comparing it to zero. Here is an example:
Code:
program:
	test(field('#myfloat'), cmp(raw_field('#myfloat'), 0, '', '#00aa00', ''), '')
The "test" function first checks to see if the field contains any text. If it does then it compares the field with zero, and if equal returns (in this example) the color green. Otherwise it returns nothing.

You must use raw_field() in the comparison because of the formatting. The word "Price" is not a number. You must use field() in the test so you can tell the difference between empty and "Price: 0.00" (or whatever it is).
I'm apparently doing something wrong.

Code:
 test(field('#price'), cmp(raw_field('#price:0.00'), 0, '', '#2aa29e', ''), '')

Last edited by Nyssa; 10-25-2014 at 11:55 AM.
Nyssa is offline   Reply With Quote