Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Note appearing in two (supposedly) exclusive agent
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1210281304

Message started by Matt C. on May 8th, 2008, 5:15pm

Title: Note appearing in two (supposedly) exclusive agent
Post by Matt C. on May 8th, 2008, 5:15pm

I have agents for a date attribute, 'deadline'. One is for capturing and flagging (with a border colour) deadlines cropping up in the next three days:

deadline=today | deadline=today+1 | deadline=today+2 | deadline=today+3

(I know this is horribly inelegant, but it worked when I was in a hurry and I haven't bothered to change it. )

Plus another agent for flagging deadlines that have whooshed past, as Douglas Adams so beautifully put it:

deadline<today

Why would the same note appear in both these agents? Aren't they asking different things?

-addendum-

I used some imagination and amended the first agent to read:

deadline<today+3 & (! #inside(áDeadlinePast))


Now a note with a deadline for today doesn't appear in the above agent (which I thought would capture it), because it's in the "DeadlinePast" agent, and so excluded.

-further addendum-

...so I modified the "DeadlinePast" agent to read:

deadline<today & deadline≠today

and it all works.

But for future reference, how does Tinderbox interpret today's date against the '<' operator?

Matt

Title: Re: Note appearing in two (supposedly) exclusive agent
Post by Mark Anderson on May 8th, 2008, 6:05pm

Experimentation shows that in the context of 'today', time is taken into account.  Deadline < today is finding a note made to test your question this afternoon (in UK) - the time is 14:48. It's now 22:40. If I change the latter note's time (date stays the same) to 23:40 it's now excluded.

Doh! I didn't read the full section I quoted from the manual (I don't use dates a lot). Manual p.114, section "Agents, Dates and times":

Quote:
Agents regard two dates as being equal if they share the same year, month, and day -- regardless of the time of day.

The comparison operators >, >=, < and <= compare both date and time, so the same note could be found by two agents: one that locates theDate < todayand another that searches for theDate = today.

What's catching you out is '=' acts differently in that it ignores time unlike other comparison operators.

So time does matter but, as already discussed default time is always 00:00 unless you set it manually or through some string. I found this worked as as a test agent action:
MyDate = yesterday 09:00
..and my date attribute duly had a date of yesterday and time of 09:00. I suspect local setting for time/date may have some bearing on the time format.  Here in UK (UK OS settings in 10.4.11) I'm doing fine with 24hr hours and with a colon hour/minute delimiter.

Title: Re: Note appearing in two (supposedly) exclusive agent
Post by Mark Bernstein on May 8th, 2008, 6:09pm

Why does = ignore time?

Because, if it compared dates and times, two dates would only be equal if they were EXACTLY the same moment.  In practice, this means a date is only equal to itself.  This isn't very useful!

(In early versions of Tinderbox, date equality was defined to take time into account.)

Title: Re: Note appearing in two (supposedly) exclusive agent
Post by Matt C. on May 8th, 2008, 7:05pm

Is time necessary on a date attribute? Could the date attribute be simplified to only include a date, which means anytime between 12.00.01 am and midnight on a particular day? Could time be a separate attribute?

Time is irrelavant to the way I work with dates--a day is fine-grained enough for me--but I'm guessing it's integral to Tinderboxes's calculations.

Matt



Title: Re: Note appearing in two (supposedly) exclusive agent
Post by Mark Bernstein on May 8th, 2008, 7:19pm

A date is always a specific day and time.  The equality operator "=" is special, in that ignores time of day; all other operators take time into account.

Notice that you can extract the day, month and year from a Date separately if you need to.

Title: Re: Note appearing in two (supposedly) exclusive agent
Post by Mark Anderson on May 9th, 2008, 4:11am

So the time-insensitive version of
Deadline > yesterday
is
Deadline > day(yesterday)+"/"+"month(yesterday)+"/"year(yesterday)
...(readers with US settings reverse day & month argument)

The latter syntax seems verbose for regular use (and I can't get it to work**). Perhaps those seeking time-insensitive date/time comparison would benefit from an additional date operator allowing a concise version of the above syntax, e.g.
Deadline > dateonly(yesterday)

IOW, for a today of '09/05/2008 09:07', it would return '09/05/2008'

** Presumably because I'm trying to compare a string with a date/time.

I note with interest we've parallel threads with the GTD-ers wanting both time-sensitive and time-insensitive (or rather timeless) comparisons within the GTD context.

Title: Re: Note appearing in two (supposedly) exclusive agent
Post by Mark Bernstein on May 9th, 2008, 2:01pm

Summary: comparing dates

= compares the calendar day only. †Date1=Date2 is true if the calendar date of Date1 and Date2 are the same, even if Date1 and Date2 are different times.

Other comparison operators compare dates and times. †

Example: if you want to find tasks that are due before the close of business tomorrow, you can search for "DueDate<tommorow 6:00PM"

(The date parser recognizes 6:00PM, but not 6PM.)

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.