Ah, I see. My bad. So, in your case, the notes appear since at least one condition is met. Yeah, I didn’t realize that.

English isn’t my primary language either, so this might be adding to my confusion. Let’s try it another way. I currently have this front matter in a note, and this is the only content in the note. Nothing else:

---
Tags: [ people/nitsa ]
Type:
Status:
Time: 2021-10-20
Due: 
Priority: High 
Completed: 
Notes:
---

I have this query in another note:

LIST
FROM #people/nitsa
WHERE Completed = "No" OR !Completed OR !Priority OR !Due
SORT Due ASC

The note appears in the results of the list. Should it be this way? If not, how should this rule be tweaked so that the note doesn’t appear if any of “Due”, “Priority”, or “Completed” are set?

As it is, the note appears even if, with the above setup, I delete the values after Due and Priority and leave them blank. Even if I add a Yes (no quotes, not that it makes any difference) as the value to Completed.

Ah, sorry, I didn’t know what “implicit fields” means, I thought it covered everything.

You need to read this documentation:
https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#implicit-fields

Yes. The note accomplish two conditions: !Completed and !Due

FOUND IT!

…and yet, I can’t wrap my head around it.

I’ve added every possible iteration of the query in a single page for testing. Then, I started fooling around with the values to see what would trigger each query. The query that works if ANY of those values is populated is:

LIST
FROM #people/nitsa
WHERE !Due AND !due AND !Priority AND !priority AND !Completed AND !completed
SORT Due ASC

I never thought this was correct, or would work, because “AND” should mean “if THIS condition is met AND this OTHER condition is met AND this THIRD condition is met, then list the page”. That’s why I was using “OR” in the first place, because I wanted any of those values to trigger the page’s appearance.

Not this has me wondering: if using “AND” works when ANY of those values is populated (as I wanted), how can you check if two or more values are populated at the same time, and trigger according to this?!?

Brackets?

This seems to work for me when just quickly toying around. I think I tested most combinations, and I created 2 test files with your YAML frontmatter to test against, giving the fields different/same/no values whilst testing to see what was filtered.

List
From #people/mary
WHERE ((Completed != "Yes") AND ((!Priority OR Priority != "") AND (!Due OR Due >= date(2021-10-11))))
SORT Due, Priority, Status desc

But it’s exactly this what the expression !Completed AND !Due AND !Priority does.
All the conditions need to be accomplished (if all ok, then TRUE). If at least one is FALSE then all the filter is FALSE.

I may be somehow unable to understand the logic behind this, but the way I (still) perceive it, the following…:

WHERE !Due AND !due AND !Priority AND !priority AND !Completed AND !completed

…should translate in English to:

WHERE Due AND due AND Priority AND priority AND Completed AND completed ALL aren't set to some value

And yet, if only ONE of them has a value, the filter works. That’s why I asked in the reply where I mentioned I found the solution that I’m wondering how do you test precisely that, if more than one values are set at the same time, if this filter works with only one of them being set.

Hmmm… I’ll have to test this out - I don’t have the time to do it currently (or I’ll fall again in a rabbit hole of testing, end up spending the rest of the day trying to make my “organizing system” work, and do zero work). I’ll try it out later and get back to you.

However, it seems close to my initial approach that was supposed to do precisely that and didn’t work for me:

WHERE !completed AND (!due = "" OR !priority = "")

…that I mentioned in my OP. From a logical standpoint it should work.

Sorry but i don’t understand. In the current filter ALL the conditions need to be TRUE (if ONE false, then all the filter is false). Now you want to know how create a filter with the condition that all the filter is FALSE only if at least two conditions are false? If that’s the case, then I don’t know how to answer.

BTW, your previous filter has more logic if write in this way:

WHERE (!Completed OR !completed) AND (!Priority OR !priority) AND (!Due OR !due)

Precisely, as I stated in my previous reply, and the way I perceive it, the current query…

WHERE !Due AND !due AND !Priority AND !priority AND !Completed AND !completed

…should work if ALL of those values aren’t set to something, right? And yet, it works when only ONE of those values is set. Or more. Which is what I was trying to do with this particular query.

As in, I have a note where all values are blank. It shows up among the query’s results. As soon as at least ONE of those values, Completed, Due, or Priority are populated with something, the note disappears from the query’s results.

As I said in my previous reply, I can’t understand why it didn’t work with “OR” but needed “AND”. If I typed my query in plain English, I want the page to appear in the query’s results…

WHERE Due isn't set, OR Completed isn't set, OR Priority isn't set, blah-blah-blah

…and yet that didn’t work. What did was…

WHERE Due isn't set AND Completed isn't set AND Priority isn't set

…which in English should mean that, for the note to disappear from the query’s results, ALL those values should not be set. Right?

Let’s look at it another way: it’s as if I had a “White:” and a “Black:” parameter, and I wanted a query to show a note with those values if either White OR Black weren’t set to a value. Notice the “OR” in the sentence. This should work if at least one of them was set to a value. That should give me a query like…:

WHERE !Black OR !White

And yet, that didn’t work, but…

WHERE !Black AND !White

…did. However, this last query above “reads” in plain English as “BOTH of those parameters SHOULDN’T be set”. And yet it works if only ONE of them isn’t set.

Not sure I know enough about Dataview, but it seems to follow first-order logic, no? Which can be a bit counter-intuitive at times.
Not-(A OR B OR C) is equivalent to (Not-A) AND (Not-B) AND (Not-C).
In other words, you can’t just “distribute” the “Not’s” across a string of conjunction or disjunction.

1 Like

Yes, close to, but not the same. :slight_smile:
I have further nesting as I figured you had missed a condition in your descriptive text here (on the forum) compared to the code you provided. Even your example in your reply in reality “only” tests for !completed and ONE of either !due or !priority (but not both), whereas mine is testing for both. My brackets are “nested” (so to speak), which is why there are no less than 4 closing brackets.

I also see that I tested “Completed” for anything that isn’t “Yes” (note the != as opposed to !Completed, which merely tests for if Completed has a, any, value).

But yeah, test it when you get the time. Would be interesting to hear if it works out.

Please think only in “True” and “False”. In your last example:

WHERE !Black OR !White

WHERE - " Filter pages on fields. Only pages where the clause evaluates to true will be yielded."
The clauses are: not black OR not white. You don’t need two “true” to WHERE be TRUE. You only need to have one “true”.
TRUE (true or true)
TRUE (false or true)
TRUE (true or false)
FALSE (false or false)

WHERE !Black AND !White

WHERE - is TRUE when the clause is true
The clauses are: not black AND not white. You need two “true” to WHERE be TRUE. If any of them aren’t “true”, then WHERE is FALSE.
TRUE (true and true)
FALSE (true and false)
FALSE (false and true)
FALSE (false and false)

Exactly.

WHERE !(Completed OR Priority OR Due) = WHERE !Completed AND !Priority AND !Due

1 Like

Aaargh, just when I feel I made sense of it…

I just tried your suggestion, always keeping the same front matter on the page. Just to ensure I’ve understood your suggestion, thanks to your nested approach, the query you offered should test…

  1. If Completed is set to anything apart from “Yes”
  2. If Priority isn’t set, or isn’t empty, AND…
  3. …if Due isn’t set, or is set to a date after 2021-10-11.

…with the last two being “bundled together”, right?

Here are the results, when adding a value to only ONE of them (as in, the page’s meta front matter has ONLY a tag, based on which we filter, and ONE of the following values set):

  • Due works as you intended.
  • Completed works as you intended.
  • Priority is fully ignored.

With that last bit I mean that no matter if Priority has or hasn’t any value, the page still appears among the query’s results. Should that happen?

Apart from my reply to @Hellquist , I should also thank everyone else who’s tried to help up to now - and especially @mnvwvnm , who’s probably spent a significant time trying to help and troubleshoot my problems.

I might not yet be precisely where I want, but I’m grateful for all your help, everyone.

Probably not, no. Actually, when thinking about this earlier today I started thinking “what are we doing again?” so I had to go back up to your first post to refresh myself on what we were actually aiming for.

My first suggestion probably overdid it. I thought you wished for a list that showed projects that were overdue, and thus compared it to a date etc. In your OP you are however saying you merely wish to figure out, and list, which projects that haven’t been completely filled in. Is that still correct?

Therefore I did another take on it. I also created a table for testing/showing me what data that was read. The left column is where I tweak query, the middle column is the results (a table followed by a list, you only asked for a list, but the table was good for highlighting and testing) and the right column contains my two test files.

In there you can see both files are now being listed, for different reasons. Both being incomplete in different ways. We are only listing projects that aren’t Completed, and one of the files is listed for lacking due date (regardless of what todays date is) and the other is listed for lacking a priority. Is this what we are aiming for?

This is the list code (for copy/paste pleasure):

List
From #people/mary
WHERE ((Completed != "Yes") AND (!Priority OR !Due))
SORT Due, Priority, Status, file.mtime desc

This is the table code if you wish to use it for testing:

Table Completed as "Completed", Priority as "Prio", Due as "Due"
From #people/mary
WHERE ((Completed != "Yes") AND (!Priority OR !Due))
SORT Due, Priority, Status, file.mtime desc

Are we getting closer? :slight_smile:

Almost. I think I’ll have to explain what I’m trying to achieve by also talking about the stuff apart from this query. Maybe there’s a better way to do things. So…

The Setup

I’m trying to use Obsidian as a hybrid for both note-taking AND task management. I don’t have project notes up to now, since I’m basically trying to organize my freelance writing gigs through this, in a “unified” setup. This way I’ll be able to tackle my tasks, time-manage my day, but also actually work on each task (since they’re basically articles, and Markdown’s great for that).

This means that I might have some tasks I have to do on a particular day, but also some notes that I’d have to check that day. Thus, I decided to use common front matter in both, and have both tasks and notes with due dates, priorities, and a Completed value (among other stuff).

Until recently I wasn’t using YAML front matter, and my “task management” was basically manually copying and pasting tasks from one day to another. Then, I decided I’d do it properly. I’ve went through all my notes and added some front matter values for better organization.

With front matter (theoretically) set up, I turned my attention to a) upgrading my daily notes to “pull” by tag and date everything I’d have to do each day, and b) create a dashboard where the rest of the tasks would appear, and embed it after the “primary task section” of each daily note. That’s where we’re currently at.

In my daily notes I have the following (note: I’m using “`` `” typed wrong intentionally, or it marks the blocks as code here as well):

### ⬜ Tasks
`` `dataview
TASK
FROM ""
WHERE (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND (due=date(today) OR Due=date(today))
`` ` 

### 🗒 Notes
`` `dataview
LIST
WHERE (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND (due=date(today) OR Due=date(today))
`` `

In the separate “tasks dashboard note” that I’m trying to create, I have separate sections for tasks that are:

Overdue

`` `dataview
TASK
FROM #tasks
WHERE (due < date(today)) OR (Due < date(today)) AND (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND (due !=null) OR (Due !=null)
`` `
`` `dataview
LIST
WHERE (due < date(today)) OR (Due < date(today)) AND (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND (due !=null) OR (Due !=null)
`` `

Upcoming

`` `dataview
TASK
FROM #tasks
WHERE (due > date(today)) OR (Due > date(today)) AND (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes"))
`` `
`` `dataview
LIST
WHERE (due > date(today)) OR (Due > date(today)) AND (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes"))
`` `

Priority: High

## 🟥 Priority: High
`` `dataview
TASK
FROM #tasks
WHERE (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND ((Priority = "High") OR (Priority = "high") OR (Priority = "hi") OR (Priority = 3))
`` `
`` `dataview
LIST
WHERE (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND (Priority = "High") OR (Priority = "high") OR (Priority = "hi") OR (Priority = 3)
`` `

### Priorities: Medium and Low
Same as the above, with a simple word swap. Or two. Because, as I realized, the YAML and dataview queries combo is case-sensitive, and I want catch-all rules for when I absent-mindedly (or because I can't see crap without my glasses anymore) type "Completed" with a lowercase "c" when typing on my smartphone. Yay for shared Vaults between desktop and mobile.

## And we're at...
...the point where I'm tweaking and re-checking everything, while also trying to create four extra queries:

One should show "the rest of tasks" (but not notes, or it would list my whole vault). It currently looks like:

`dataview TASK FROM #tasks WHERE (!completed OR (Completed="No") OR (Completed="") AND !(Completed="Yes")) AND (!priority OR !Priority OR !due OR !Due) `


...because I haven't yet reached the point where I can filter-out the results from the previous queries, so, there's lots of repetition.

But also trying to create three more queries, about which this post is about, where I'm trying to list tasks and notes **not** listed with the queries above, based on the tags I'm using for particular people. So, they should show tasks and notes from, say, #people/mary, but NOT if those notes already appear under my Today or High/Medium/Low priority queries.

I think this should all make more sense now - while also make you wonder WTF I'm doing and why I'm not using X, Y, or Z better approach I probably don't know about :smiley:

By the way, with “Almost” I didn’t mean “your solution is ALMOST what I wanted, but not there yet”, for I think it’s precisely what I was trying to achieve.

Instead, I meant “Nope, that’s almost what I’m trying to achieve, but I think your approach works even better”.

I also don’t mind tables :slight_smile:

1 Like