Exclusions in searches

Hi all -

I’m new here. I’ve been loving TaskPaper and finding these forums invaluable in getting started and customizing it to suit me.

One thing I’m stuck on is excluding projects and tags from search results. I’ve read a few form topics on this, including:

However, maybe I’m being a bit thick, but I’m not getting the result I want.

I’m trying to create a Next 7 Days search that includes @today, @due, and @start, and excludes @done, @waiting, and the Archive: project.

This is my current version. It still shows tasks in the Archive project.
@today union @due <[d] Tomorrow + 7d union @start <[d] tomorrow + 7d except /Archive//*

For example, a task that still shows in Archive after this search is:
@waiting on @bob and @brian to respond to @chuck re question @due(2018-07-17) @done(2018-07-16) @project(MyProject / Clear up that issue)

I also tried adding “except @waiting//*”, to the search (based on what I see in the default not done search, but it doesn’t seem to do anything. So, I had the following - maybe you can’t chain except clauses like that?
@today union @due <[d] Tomorrow + 7d union @start <[d] tomorrow + 7d except /Archive//* except @waiting//*

Thanks to anyone who can shed some light on this for me!

Cheers,

David

1 Like

Try this. I just added parentheses to make sure that except /Archive//* is evaluated last:

(@today union @due <[d] Tomorrow + 7d union @start <[d] tomorrow + 7d) except /Archive//*
2 Likes

Yup. For some reason I think I tried and failed using parentheses.

Here’s what I have now that seems to be working:
((@today union @due <[d] Tomorrow + 24h union @start <[d] tomorrow + 24h) except //@waiting) except /Archive//*

Thanks for the help!

1 Like

Thanks! This is helpful, but I am simply trying to find anything not @due and not @done. I tried not @due and not @done as well as not @due union not @done as well as several other incantations. What am I missing?

The problem with “not” searches is they won’t work as expected if they match child items of the “not” item. For example:

- a @done
	- b

If you search for “not @done” in this case then nothing will get filtered because “- b” passes the “not @done” test… and “- a @done” is included in search results since it’s the parent of “- b”.

To filter out “@done” items AND all items they contain you can use “except”. For example

//* except @done///*

That means:

  1. Find everything: //*
  2. Minus: except
  3. Done items and all descendants: @done///*

And last to extend that to also exclude @due items you can use:

//* except @due or @done///*
1 Like