Tinderbox v9 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:


Do not use this form:


IMPORTANT: Tinderbox will accept a single '=' but only to stop code breaking in very old TBX documents 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):


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: