Book MOC which surfaces all INLINKS, need to exclude/filter Journal

I’m creating MOC’s of every Book I’ve read and captured notes for.
I want the MOC to surface a link to all the relevant notes.
I’m using the following code, which is working great:

TABLE without ID
file.inlinks as "Referenced"

However, as per the title, it’s including times I’ve linked to the Book in my Journal.
So the table ends up being 50% dates.

How can I exclude or filter out these results in the Table?

I’ve tried adding a WHERE !“Journal”
Also tried adding a WHERE !contains(file.path, “Journal”)

It may be helpful to know I have a PROPERTY named “Type”.
In all my Journal entries, this “Type” is set to [[Journal]]

Since you have the Journal as a property try adding the following at the end of the WHERE line.

WHERE ... NOT type = "[[Journal]]"

The “…” is your original code.

Appreciate the response, but unfortunately it’s not worked.

To be clear I tried:
WHERE = NOT type = “[[Journal]]”

I’m getting the following error:

It seems we cannot use “NOT” as a way to exclude.
I tried using “AND” with a ! to indicate NOT.
My tests are below.

I’ve tried testing with:
WHERE = AND file.path != “Journal”

But this just gives me the same list, which includes all my Journal entries, link this note.

And, I’ve tried testing with:
WHERE = AND !“Journal”

But this gives me no results.

Sorry about that. Because it was a type I thought it would be the best place to start. I am not an expert, I usually do some trial and error.

I replicated the way you have your metadata set up. Since you are using a Link for the Journal, you should be able to exclude any note that has that link using the FROM command in your query.

TABLE without ID 
file.inlinks as Referenced
FROM ![[Journal]]

Also, make sure that since you have a link in the properties/metadata area it is formatted correctly: "[[Journal]]". Other wise it will not treat it like a proper link (as far as I’ve read in documentation).

This really cause me some issues until I figured it out.

If this doesn’t work I trust the forum will know where I have gone wrong. :face_with_peeking_eye:

Don’t apologise my man, you’re just trying to help which is SUPER appreciated!

Unfortunately this didn’t work either, it gives me the list but still includes all the Journal Entries where I’ve linked to “this” note.

I also tried:

TABLE without ID
file.inlinks as Referenced
FROM !“Journal”

Same result

Check your formatting on the query.

And the formatting in the property field as well in the note.

To be clear I tried:

TABLE without ID 
file.inlinks as Referenced
FROM ![[Journal]]


TABLE without ID 
file.inlinks as Referenced
FROM !"[[Journal]]"


TABLE without ID 
file.inlinks as Referenced
FROM !"Journal"

all produce the same result, which still includes my journal entries…

Is the note property field formatted correctly?

I made one of my properties a link and then excluded from my query using the format I gave you and it worked. I may not be reproducing the conditions you have.

I look forward to what the forum says. Now, I’m both at a loss and curious.

Here’s an example of the frontmatter / property, of a note which IS appearing:


Ok. So, I replicated what you provided: A link inside a note property that has the property type of “list”.

I have other exclusions using the FROM command, mainly my template folder. And I am querying my entire vault. So, I should be close to what you have. And you said your original query was doing what you wanted it to do except for the exclusion.

I honestly don’t understand why it is not working. This one has me stumped. I must be missing something.

I await some form of revelation from much wiser forum denizens.

What’s wild, is even when I specifically call out a file that IS showing up, that I don’t want, it still includes it in the resulting table.


TABLE without ID 
file.inlinks as Referenced
FROM !"[[Journal]]"
WHERE = AND !="2024-03-07"


Something is overriding your query.

Are the book notes in a folder? Or are they tagged in some way you can target?

All the book notes have a Property named “Type” set to [[Concept]] so that could potentially be used.

With respect to location, they all live in one of two folders, depending on how processed they are. So I could potentially use that also?

Maybe that’s the solution… to limit where I’m searching, rather than searching all and then excluding :thinking:

Ok… this is my last try… :laughing:

Option 1: This should grab only those notes with the property “Concept”.

TABLE without ID file.inlinks as Referenced
WHERE type = "[[Concept]]"

Option 2: Grab notes with the property “Concept”, and exclude any with the link to journal.

TABLE without ID file.inlinks as Referenced
FROM ![[Journal]]
WHERE type = "[[Concept]]"

Option 3: Trying to cover every base. :man_shrugging:

TABLE without ID file.inlinks as Referenced
FROM "File/Path/to/folder" AND ![[Journal]]
WHERE type = "[[Concept]]"

Again, really appreciate your efforts on this, but unfortunately still not working…

Guess we’ll see if anyone here want’s a challenge, it’s got me stumped too.

I even looked at how you can include and exclude things in the Graph view, to use the same syntax or terminology from there, hoping that’d help, still nada.

I noticed in the Graph View, you can exclude a Property by using:

Thought that’d help, but no dice.
I guess that’s because Obsidian language, is different than Dataview.

Lets build this query from the start after establishing a few facts you’ve included in this thread.

  • All of your journals has a property: type: "[[Journal]]" – This is good since this then considered a proper link, with Obsidian’s full link handling
  • The type field is a list type – This causes a shift from doing type = ... to contains(type, ... ). You can’t check for equality directly between a property being a list and a single value, hence the need for contain()
  • A link is never the same as a text string (and also not the same as a date), even if they kind of look similar in the output. So to compare a property with a link, you need to generate a link to compare it to, like in type = [[Journal]] or type = link("Journal") or similar variant. Examples given for an equality comparison, but the same applies when using contains()
  • There is a difference between which files you’ve filtered to include, and the file.inlinks and file.outlinks of those files. So after selecting the files you want to appear as separate rows in your table/list, you need to filter out unwanted items from either of those lists
  • Using the folder location can be tricky, so having a file property is often a better approach, so we’re going to stick with that
  • The syntax of doing searches and dataview queries are very different, so we need to focus on one of these. The syntax used for queries is the same as the filtering of graph views. I’m going to focus on the dataview query now

A reformulation of what the query should do, as I understand it, is as follows:

  • Within a book note, you want to link all files linking to it, excluding those being within your journal

Try out this query:

FROM [[]]
WHERE !contains(type, [[Journal]])

Using the FROM [[]] should give all files where there is an outgoing link to the current file (aka your book), and then we exclude any file having a type property (being a list) which contains a link to the “Journal” note. If the query above doesn’t provide the wanted output, you need to verify that the type property is actually an list, and please provide any example notes not being included in a follow up post.

If I’ve understood your use case correctly this should suffice, and there shouldn’t be any need to include the file.inlinks. If on the other hand you wanted to make a table out of all books with their inlinks, it would look a little different. Then maybe the following untested query would work out:

TABLE References
WHERE contains(type, [[Concept]])
FLATTEN list(filter(file.inlinks, (i) => !contains(i.type, [[Journal]]))) as References

This should start by filtering out all your books (aka having a type with a link to “Concept”), and then it builds a filtered list of the file.inlinks where neither is of the journal type.

Hope this helps, and gets you closer to your goals.

1 Like

Thank-You !!

The first suggestion worked, but of course, you already know that, don’t you :wink:

You’re such a legend, super appreciate your work here. I see you accurately solving so many of the community’s questions.

And not only this but taking the time to detail the logic behind your work.

Have an amazing life, you’ve surely created a lot of positive karma in your generosity!


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