List all files with a specific heading

What I’m trying to do

  • I have a file for each employee.
  • I have a file for each day.

Inside of the employee file, I want a list (and link) of all days in which I’ve had a specific meeting with them. Meetings of the same type always have the same header (for example Jane Doe Weekly :handshake:). The end result I want is:

Jane Doe Weekly :handshake:

  • [[2023, July 20 - Thursday]]
  • [[2023, July 13 - Thursday]]

Side question: can those page links link directly to the heading?

Bonus question: can we include the content of that header under some sort of foldable element?

Things I have tried

I am clueless. Sorry.

I don’t think that this is currently possible

If (1) your daily note file names are in ISO 8601 format (“YYYY-MM-DD”) and (2) the header is in the daily note and your meeting notes under the header are list items (i.e., bullets):

```dataview
LIST
WHERE file.lists
FLATTEN file.lists as L
WHERE meta(L.section).subpath = "Jane Doe Weekly" 
and contains(file.path, "daily note folder here")
GROUP BY link(file.link, dateformat(file.day, "yyyy, MMMM dd - cccc"))
```

or, if you want the notes too:

```dataview
LIST rows.L.text
WHERE file.lists
FLATTEN file.lists as L
WHERE meta(L.section).subpath = "Jane Doe Weekly" 
and contains(file.path, "daily note folder here")
GROUP BY link(file.link, dateformat(file.day, "yyyy, MMMM dd - cccc"))
```

Now, if your daily note file names are not in ISO 8601 format and you just want them as is (i.e., the way you have them in the OP), then the last line of the DV query block should just be GROUP BY file.link. If not, I’d suggest changing your file names to ISO 8601.

If you want to fold it, you can shove the whole thing into a callout:

> [!info]- Jane Doe Weekly 
> ```dataview
LIST rows.L.text
WHERE file.lists
FLATTEN file.lists as L
WHERE meta(L.section).subpath = "Jane Doe Weekly" 
and contains(file.path, "daily note folder here")
GROUP BY link(file.link, dateformat(file.day, "yyyy, MMMM dd - cccc"))
```

As far as I know, you can’t put each weekly meeting’s link in a separate callout unless you had separate Dataview queries for each week. But, then you’d have to specify each weekly meeting’s daily note file name and mod the callout. Something like:

> [!info]- Jane Doe Weekly - 2023-07-13
> ```dataview
LIST rows.L.text
WHERE file.lists
FLATTEN file.lists as L
WHERE meta(L.section).subpath = "Jane Doe Weekly" 
and contains(file.name, "2023-07-13")
GROUP BY link(file.link, dateformat(file.day, "cccc"))
```

Lastly, I don’t think you can link straight to the headers in a DV query.

Hopefully, some of this will get you on your way.

3 Likes

Omg! you’re awesome. Any tips or resources to learn this? I feel like Obsidian has a lot of potential, but I get overwhelmed and ask for help.

First, if you’re new to Obsidian, before you go any further I suggest you create a note and write down what you want to do with your vault. A vault plan will help you stay on track with what you should build first in order to answer the questions you have about your notes.

Second, I suggest you read the Obsidian User Guide.

For Dataview:

You can also find help in the Obsidian Discord Dataview channel. You can search the channel for DV code chunks or ask for help with DQL syntax. And, of course, this forum.

2 Likes

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