I feel like I’m close here. I have a YAML field on notes for “#person” called “reachout” that shows a date when I want to reach out to a given person.
On “today’s note”, I just want to show all of the people to reach out to that day, along with any that have older dates that I’ve missed.
WHERE contains(reachout, “”) AND date(reachout) <= this.file.day
SORT file.name ASC
I have contains(reachout, “”) because I’ll have a bunch of contacts with no need for this, and then the second half should pull those with a date earlier than the date of that daily note. However, it’s showing no results when I know it should.
I think that bit is not quite doing what you want it to do. What does the “reachout” field look like on notes that don’t need it? Is it blank? Absent?
General Investigation strategy for something like this: add columns to your table with the fields you are using in your query to make sure they look like what you expect. E.g. in this case I might add to your existing columns of email, phone a column with reachout and another column with date(reachout), temporarily remove your WHERE line (or half of it) so you get results (you can always add something like LIMIT 10 as a last line if removing WHERE would give you wayyyy too many), and make sure your results match your expectations.
That is promising! Maybe add a column for this.file.day then? (Yes it’ll show the same thing for every row, but the practice of just sticking all the different things in columns works for me because then I know I’m getting dataview’s interpretation of all the stuff at the same time while I’m investigating.) You could also add a column for date(reachout) <= this.file.day AS "Reachout Before Today" (or some other name of your choosing…) and see what appears there!
Below may be just “fun facts” since this doesn’t seem to be your issue, but for clarity:
Then you can simplify the bit before the AND to just WHERE reachout, which will check whether reachout is present or not.
Contains is for checking whether a string or a list (in your case the value of the reachout field) has some thing in it. I suppose a non-existing field does not contain “” and an existing field does, so it works, but I was very confused when I looked at it!