Dataview using OR?

Things I have tried

I have tried simply adding an OR between statements.

What I’m trying to do

I’m trying to combine to dataview task lists into a single list of tasks. Tasks can be in a note with a tag of #name or in a note for a project with an inline particpant name of name. I have both lists running fine if I have them separate, like so:

TASK
WHERE contains(Participants, [[name]])

and

TASK
WHERE contains(tag, #name)

I can run them right after each other but was looking for a way to get them into one list, I will leave them broken out if its too difficult of an ask, but I can’t seem to find many or queries, and queries seem to work fine.

Have you tried what your title implies? “OR”?

TASK
WHERE
  contains(Participants, [[name]]) OR
  contains(tag, #name)

smh…I tried it but I tried WHERE OR WHERE…let me try without the second where

I way overthought that, that was really really dumb, thanks for the help!

1 Like

If you do two WHERE’s, they’re assumed to have an AND between them. So it’s legal, but it’s an AND, and not an OR.

```dataview
task
from "ForumStuff"
WHERE startswith(text, "second") AND
  (status="x" OR completion) 
```

Which outputs this in my test vault:
image

Here you see that all tasks have that first part of starting with “second”, but the first two has the status="x" which marks them as completed, and actually the last two has the field completion shown as the completion date.

So that’s one way to build a combination of AND and OR. Just remember the parentheses around the criteria for OR parts if combined with something like an AND.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.