Creating a Dataview Table with Specific Frontmatter and Exclusions

What I’m trying to do

Hi everyone,

I’m trying to create a Dataview table in Obsidian that includes files based on specific criteria and also excludes certain files. Here’s what I’m looking to achieve:

  1. Include Files: The table should include files that:
  • Have the frontmatter field "Home" containing "Note-making MOC - MDR".
  • Are located in the directory: "00001. Zettelkasten System/0003. Notes/001. Reference Notes/Fleeting Notes".
  1. Exclude Files: The table should exclude files that are already linked in the "Note-making MOC - MDR.md" file located at "00001. Zettelkasten System/0002. Maps of Content/Note-making MOC - MDR".

Essentially, I want the table to show me what files I have marked in the "Home" frontmatter as "Note-making MOC - MDR" that haven’t yet been added to the "Note-making MOC - MDR.md" file.

Things I have tried

TABLE without ID
  file.link as "To Add to a MOC - Note-making MOC - MDR",
  round(max(0, (date(today) - date(file.ctime)).days)) AS "Days Live"
FROM
"00001. Zettelkasten System/0003. Notes/001. Reference Notes/Fleeting Notes"
WHERE 
contains(file.frontmatter["Home"], "Note-making - MOC")
AND
!contains(file.path, "00001. Zettelkasten System/0002. Maps of Content/Note-making - MOC")
AND 
length(filter(file.outlinks, (l) => l != "[[00001. Zettelkasten System/0002. Maps of Content/Note-making - MOC]]")) > 0

This is my first post, and slightly to wordy. I revised it and reposted (so please disregard the above post).

Here is the repost: Filtering Files in Dataview Table by Specific Conditions

I found the solution. When I have a MOC and I add front matter to a note linking it to the MOC, this will generate a table listing the files I still need to add to the MOC file itself. I add the query to the MOC file itself.

TABLE without ID
file.link as “To add to Note-making - MOC”,
round(max(0, (date(today) - date(file.ctime)).days)) AS “Days Live”
FROM “00001. Zettelkasten System/0003. Notes/001. Reference Notes/Fleeting Notes” AND -outgoing([])
WHERE contains(file.frontmatter[“Home”], “Note-making - MOC”) AND !filter(this.file.outlinks, (o) => contains(file.outlinks, o) OR contains(file.inlinks, o))
sort file.name asc

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