Queries & conditional expressions support 6 basic comparison operators:
- ==. Equals. (See below re == and comparing dates. A single '=' usage is supported for legacy code purposes but is deprecated in v4.6+.)
- !=. Does not equal. The Mac OS specific ≠ symbol may be used interchangeably with !=.
- >. Greater than
- <. Less than.
- <=. Less than or equal to. The Mac OS specific ≤ symbol may be used interchangeably with <=.
- >=. Greater than or equal to. The Mac OS specific ≥ symbol may be used interchangeably with >=.
Comparing date (data type values) with the == and != operators. Agents regard two dates as being equal if they share the same year, month, and day — regardless of the time of day. This makes useful agent expressions that use the == equality operator. In early releases, equality looked only for identical time stamps, which was rarely what users expected.
For all other date comparisons, the time element of date-time attribute value is taken into account. Where no explicit time is set, the time defaults to '00:00' (hh:mm). Seconds are not displayed in key attributes or Get Info. Seconds are '00' in most cases unless specifically set otherwise (via action code or use of designators link 'now').
To test the exact equivalence of date attribute values use interval() where an exact match returns the string "00:00".
Note that the comparison operators >, >=, < and <= continue to compare both date and time. It is possible, for example, for the same note to be discovered by two agents with different query operators, one that locates $TheDate < today and another that searches for $TheDate == today. If the $TheDate has a time of 14:30 and today has a time of 11:00 then both queries will match; the first matches simple on a time agnostic whole-day basis, the second matches because 14:40 is later (greater) than 11:00.
The date parser accepts the following expressions as placeholders for calculated dates (within quoted string literals):
There is a further special case:
- never. No date - earlier or later than any real date.
Day placeholders Sunday, Monday, etc., may be used. Tinderbox recognises the day of the week (in English, currently) and interprets it as the day after today with that week day. Thus on Sunday June 1, the date "Sunday" refers to Sunday, June 8.
In other respects, days of the week act like today and can be modified similarly, e.g. "Monday - 1 week" evaluates as the previous Monday.
Parentheses (rounded brackets) can be used to indicate a hierarchy of resolution:
($Cost > (450 * $Margin)) & ($Priority == "High")
The code in parentheses is resolved before the '&' join is made.
Agent query comparison operations will accept expressions on their right-hand side. This is legal syntax:
$Width > ($Height * 2)