Get (most recent) mday of the backlinked notes of backlinked notes

What I’m trying to do

I keep track of my dossiers by creating a dossier-note and link all kind of notes relevant notes to that dossier-note. Dataview is a master piece in keeping track of things. There’s currently one thing I can’t solve.

I created a ‘Dossier overview’ that shows all dossiers and their mutation date (file.mday), but what I actually want is the modification date of the most recent updated note that links to my dossier-note.

So i.e.

   Any Note    -> Dossier-note
1. mday Sept 6 -> Obsidian
2. mday Sept 7 -> Elaborate x
3. mday Sept 8 -> Obsidian

Now I want the Dossier overview to show:

Dossier Last Updated
Elaborate x Sept 7
Obsidian Sept 8

Any solution is fine. I can think of a property field that is reused, but also about a dataview query that delivers the wanted result. But I am stuck, cause I wasn’t able to figure out a way to populate the property field in response to a note update, and for the second approach, I don’t know how to write a nested query in dataview.

Things I have tried

My best attempt resulted in this:

```dataview
TABLE without id
	link(file.link, title),
	max(date(file.inlinks)) AS "Most recent date"
FROM "Dossiers"
```

This works but shows, for as far as I understand, the initial file creation date. Is there anyone with a bright idea how to achieve my goal? :slight_smile:

1 Like

Well, after some more digging I found out that dataviewJS might the way to go. I tried some things to see if I could figure out how to query the inlinks from my dossiers. I managed to produce a list of inlinks, but have no clue how to “query” the inlinks to get their mday-values and select the most recent.

```dataviewjs
for (const page of dv.pages('"Dossiers"')
	.where(page => page.file.path != dv.current().file.path)) {
    dv.paragraph(page.file.inlinks);
}
```

I understand that dv.paragraph is just displaying the output, but to validate the output it does enough for me.

Anyway, I am lost and hope someone can push me in the right direction to eventually get a table with the files and the date of the most recent inlink.

Apparently I am not allowed to edit my post.
I got it one step closer:

```dataviewjs
for (const page of dv.pages('"Dossiers"')
	.where(page => page.file.path != dv.current().file.path)) {
	for (const inlink of page.file.inlinks) {
		dv.paragraph( page.file.name + "->" + dv.page(inlink).file.mday );
	}
}
```

Well, despite the lack of responses, this is what I ended up with.
I hope it’s of any help to others:

```dataview
TABLE without id
	link(file.link, title) AS "Dossier",
	max(map(file.inlinks, (i) => i.file.mday)) AS Updated
FROM "Dossiers"
SORT file.name
```

Some keywords for the search engine: nested query backlinks change modification date table column

1 Like

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