This version is out of date, covering development from v6.0.0 to v6.6.5. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

TinderboxSix Icon

Short Boolean form

It is possible to cite attribute tests in both a long form:

if($MyBoolean == true) 

if($MyBoolean != true) 

or a simple short form:

if($MyBoolean) 

if(!$MyBoolean) 

Note in the negative version the '!' moves in front of the attribute name (and the $-prefix). Thus !$MyString means $MyString has no value set whilst !$Name(Test) causes a reverse pattern query where all note's whose title does not include the string "Test" are matched.

Though the short form is primarily for Boolean attributes, where another data type can be coerced to a true/false equivalent the short form may be tried. The coercion being tested depends on the attribute type's default value. Any value other than the default, results in a coercion of true. $ChildCount is a number type attribute so the default is zero. Both the code examples below equate to the same test but the latter is shorter - useful in longer, more complex expressions.

if($ChildCount > 0) {… if($ChildCount) {…

The converse would be:

if($ChildCount < 1) {… if(!$ChildCount) {…

Note that the short Boolean form, whilst coercing non-Boolean type values to a true/false occurs it is not testing whether the default value is inherited or was explicitly set; see also use of the |= operator.



A Tinderbox Reference File : Actions & Rules : Short Boolean form