Workspaces based on AND (OR|OR)

I am one of those people who has replaced Notational Velocity (NvAlt) with Drafts to use it as a repository for all my “knowledge” as well as current writing projects notes on their way to Ulysses.
I would like to make Workspaces based on: “One AND ( OR OR )”
Simple use case to illustrate is to be able to sort into workspaces “HowTo and fixes for MacOS” and “HowTo and fixes for my cottage in the woods”.
Obviously this would also make it possible to separate “My first book” and “My second book” with lots of common tags.

Do you mean that you want a workspace which displays drafts whose tags conform to the expression x AND (y OR z)? As it is, Drafts can’t encapsulate that logic purely with a workspace tag-filter, though you could programmatically construct a list of matching drafts via script whenever necessary.

However, if you want to only match one of the OR’d tags, then the logic you want is really (x AND y) OR (x AND z) (but implicitly not all three tags at once). This can be expressed as two workspaces, viz:

  • x AND y NOT z which in Drafts is x,y,!z with the operator set to All.
  • x AND z NOT y which in Drafts is x,z,!y with the operator set to All.

I see now that what I wrote was confusing. Thanks for trying to understand Matt.
What I want is more like:
if (x)
then ANY of a,b,c,d,e,f

Where ANY works like the current Any in workspace filter: OR search including any listed tags.

The best strategy for that right now would be via scripting, I think. If you want to choose from a list of appropriate drafts and open one, you could use a prompt (or my own MGCheckListPrompt). If you want a listing of all such drafts, you could programmatically create or update a sort of table-of-contents document of all drafts matching the criteria, with [[cross-links]] to their titles.

I created an action to do this, which then asks you to choose one of the matching drafts to open. You can adapt it for your needs. It’s here: https://actions.getdrafts.com/a/10s

Edit the “Define Template Tag” step to specify the tag filter you want. You can duplicate the action to keep multiple sets of filters. It looks like this:

AND: mynovel notes
OR: characters locations research

This would produce a list of drafts whose tags contain both “mynovel” and “notes”, and which also contain at least one of “characters”, “locations”, and “research”.

1 Like

You could accomplish this specific filter by using an “any” tag filter of a,b,c,d,e,f and putting x in the search query field of the workspace, as the search field will also look for tags.

Limits your ability to filter within the workspace a little, admittedly, but it would work.

1 Like

Thanks @agiletortoise By using a tag that is uniq and not part of any word as x this works very nice. The nice thing for me is that I already have a tag that is uniq for my current book project.

Thanks Matt. By the way I stumbled over your blog just some days ago. You cover a lot of interesting stuff regarding Drafts.

Ah, you’re welcome. Thanks for reading!