Conditionals and Boolean Expressions

Starting from 2.16 Zooper Widget supports conditionals statements in every text area where variables can be used, from 2.34 also boolean operators are supported (&& ||) along with brackets parentheses and math expressions. Conditionals use  the special  $ delimiter following this pattern:

$ LEFT OPERAND RIGHT [? THENTEXT [: ELSETEXT]] $

At the time being supported operands are:
‘=’ & ‘!=’ for identity, supports both Strings and numbers (if you need to use math here please start and end expression with () please check math expressions page for more info)
‘<’ (less then), ‘>’ (greater then), ‘<=’ (less then or equal), ‘>=’ (greater than or equal) for numbers only (here math is always parsed)
‘&&’ (logical AND), ‘||’ (logical OR), es $ 3>2 || 2> 1 ? yes : no $
Brackets ‘[' and ']‘, es $ 3>2 || [ 2> 1 && 1 = 1 ] ? yes : no $

The then and else parts are optional, if the then is not present then the LEFT will be rendered only if it is a math expression (so like $(3+1)$, if else instead is not there an empty string will be chosen when condition is false.

Examples:
$#BLEVN#>10?Good!:Look for a charger!$ will render “Good!” if battery level is greater than 10 or “Look for a charger!” otherwise
Rich Text [c=$#BLEVN# <= 10 ? #FF0000$$#BLEVN# > 10 && #BLEVN < 25 ? #FFFF00$$#BLEVN# >= 25 ? #00FF00$]#BLEVN#%[/c] will write battery level (es 10%) in RED if battery is <= 10%, yellow between 10 and 25, green otherwise
$(abs(#C0DD#-#DD#) = 0) ? Today$$(abs(#C0DD#-#DD#) = 1) ? Tomorrow$$(abs(#C0DD#-#DD#) > 1) ? #C0EEEE$ will write first calendar entry day name writing “Today” if its today, “Tomorrow” if tomorrow, the name of the day otherwise
$#C0SHH:mm#!=00:00$ will render the starting HH:mm of first calendar event only if it is different than “00:00″
Is it August $#DM#=8?Yes:No$ will render “Is it August: Yes” during August, “Is it August: No” otherwise
$#LCN#!=Germany$ will render the Country name only if its not Germany (nothing otherwise)
$#C0D#=1?#C0Shh\:mm#$ will show the time of first calendar event start in 12 h format only if the entry is not an all day event (please remember to escape the “:” into “\:” otherwise it will be considered an “else” block!)

Feedback and Knowledge Base