List of Pages where a person note is mentioned (or a person note + tag)

Things I have tried

various code and queries, not sure if this is dataview if there is no YAML

What I’m trying to do

I’ve been using dataview to make a list of all conversations w/ a person (each conversation is a note w/ YAML). But sometimes I just make a daily note where I may mention a person’s name (as a page link, not a tag). eg. [[Doe, John]].

What if I’m trying to make a list of all daily notes where a person is mentioned, or even better, all notes (globally or just in the daily notes folder) where a person is mentioned AND a tag exists on that page for a particular topic?

No clue where to start on this one or even if it’s possible, but would be very helpful to narrow down my notes. Is this just a search paramater? Can it be a list like in dataview? Can I view these in a graph as well?

THX!!

Hey! I decided to give this a try, and I think I have a solution for you. I made two notes which both link to [[Doe, John]] and contain the tag “testing”, then put this data query in a new note:

LIST 
FROM [[Doe, John]] AND #testing 

Here’s the output:

Hope this helps!

Hey and thanks! I tried that and didn’t work, but maybe I’m not writing the info right… do i need the 3 ``` marks? When I copy/pasted what you have, it also said plaintext… what is the exact syntax?

Screenshot 2023-01-03 at 19.25.49

actually i got it work by changing “plaintext” to “dataview”!! how would I then limit it to a folder and not all my database?

Ok great! To make it from a specific folder, just add the name of that folder to the source query like this (I used my inbox folder):

LIST 
FROM [[Doe, John]] AND #testing AND "Inbox"

And if the folder you want is nested in another folder, you need to use its path instead of just the name, like “ParentFolder/TargetFolder”.

Does that work for you?

1 Like

Genius. I had to put “Notes/Daily” as my daily notes folder is under notes… seems to work, but is this the correct syntax for nested folders?

That’s how the dataview reference says to do it, so I’m gonna say yes. I’m glad it’s working for you! :smiley:

1 Like

thanks for the help!!!

1 Like

One more question, sorry, seems my list has no apparent order. what if I want to sort alphabetically? SORT ??? DESC what is the title field? or can I do it also by note date?

You can use the file name for this: SORT file.name ASC
Check out this Dataview query builder. It can help you figuring these things out on the future :slight_smile:

2 Likes

I wasn’t quite sure how to sort alphabetically, so I did some research and testing. Looks like adding SORT file.name ASC to your query will do the trick! For sorting by date, SORT file.ctime ASC seems to work. This overview of query types and this overview of data commands can help you customize further!

1 Like

Have you seen AutoMOC? GitHub - dalcantara7/obsidian-auto-moc

1 Like

great, will study up on the builder.

1 Like

thanks, have a lot of studying to do! cheers.

1 Like

thanks!

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