Basic Comparison Operators

Tinderbox Icon

Queries support 6 basic comparison operators:

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'.

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:

There is a further special case:

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) 

Up: Objects & Concepts
Previous: Coding conventions   

[Last updated: 14 Dec 2009, using v5.0]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox