Tinderbox Forum

How do I create an agent which will filter all open tasks?

I have tasks to which I haven’t bothered to add dates.

So how do I create an agent which will filter all open tasks?

Too broad a question as we need a bit more info:

  • By what criteria do you define a note as a ‘task’?
  • How do you define an ‘open’ task.
  • What date attributes do you need to set, to what date? (i.e. today, tomorrow, 1 year from now?)

oh okay.

I just created a note and then set the prototype to tasks. Now I need to filter all these tasks protype using an agent. Hope I am more clear?

Adding the screenshot if it is still not clear.

Ok, so we now know you are using the built-in prototype ‘Task’.

That helps because when a note uses a prototype, the name of the prototype is stored in the note’s $Prototype attribute.

If we inspect Get Info for note ‘xx’ and look at $Prototype:

We see $ Prototype has the value Task. Therefore we know this is true for all notes using the ‘Task’ prototype. This makes it easy to write a query:

$Prototype=="Task"

An agent using the query above will find all notes using the ‘Task’ prototype. But that is all Task notes. Let’s assume—as you don’t define your method—that an open task is one with no due date. In other words, the value of $DueDate is "never". Now we can improve our query to find only those task notes with no due date:

$Prototype=="Task" & $DueDate

Notice we test for the prototype first because there will be fewer matches to the Task prototype than notes with no due date set.

Hopefully that gives you enough to find the desired notes.

As a general pattern, agent queries in involve one or more query terms (in the last above there are two terms) that test some combination of a note’s:

  • attribute value
    *location in the document outline (i.e. all or part of its $Path).

So going back to your original question “How do I create an agent which will filter all open tasks?”, the way to help yourself is to ask it like this: “What defines a Task note?” and “What defines an open Task note”. Using the latter approach will help you spot the likely query terms you need.

†. Why “never”? this is the default value for all Date-type attributes with no value set.

3 Likes

Woah! You rock!

Thanks for your patience :slight_smile:

2 Likes

No problem.

Also, sorry for a long answer, but I figure giving the background thinking would help you and others get a head start on other queries too! :slight_smile:

2 Likes