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

Simple Queries - equality and inequality

A very common desire when starting out with agent queries test is a given attribute does - or does not - match a specific value. Here, 'match' implies equality, i.e. the two are exactly the same. The exactitude relates to subtleties like the fact that 'Ant' and 'ant' are not the same as one starts with an uppercase character. If new to using code and queries, take a moment to familiarise yourself with Tinderbox's comparison operators.

Thus to match all notes that have a colour of 'red', the query is:

$Color=="red" 

Do not use this form:

$Color="red" 

IMPORTANT: Tinderbox will accept a single '=' but only to stop code breaking in very old TBX documents. at some point this support will cease, so do not use the '=' form in queries and update old code.

Inequality is tested using '!=" (exclamation mark + equals sign):

$Color!="red" 

Note the inequality test only used a single equals sign, i.e. do not use '!=='.

If woking with Date-type attributes and testing a specific date, it is best to use the date() operator to enclose the actual date string. This ensures Tinderbox turns the string into a Date-type object before doing the equality test:



A Tinderbox Reference File : Agent & Queries : Simple Queries - equality and inequality