Dataview #born dates

Hi, I’ve asked about this in the Discord, and got something that’s half there. But not quite. So I’ll try here.

What I want to achieve
I want to list people born in a country/city/state on the note of this state, using data view

What I have
I have a file for each day of the year, in ISO date format. So April 19, is “04-19” and so on. On each of the notes, I have bullet lists of things that happened on that date. Usually things from Wikipedia and other sources, but also all my own stuff. I do use daily notes, but I also tag all notes to the date WITHOUT the year.

So if I make a note today (“2021-07-09”) I also link it to “07-09”. That way, next year, I can see what I did/made on this date.

People born
I use bullet points to add facts on the day of the year notes. So today, “07-09”, it could look like this:

• 1819 Elias Howe, inventor of sewing machine, #born in Spencer, Massachusetts.
• 1957 Marc Almond, singer, #born in Southport, Lancashire, England
• 1959 Jim Kerr , singer, #born i Glasgow, Scotland

I do this for other events too, so #born is just an example.

Now for the problem
On the note for Scotland, I want to have a proper listing for “People born in Scotland”. If I just use dataview, I only get the note name, which for this would be “07-09”, and not “Jim Kerr”.

So I guess I need dataviewjs, which is where my skills in code start to fail.

I got this suggestion:

//get all md files in vault
const files = app.vault.getMarkdownFiles()
//create an array with the filename and lines that include the desired tag
let arr = => {
const content = await app.vault.cachedRead(file)
//turn all the content into an array
let lines = await content.split("\n").filter(line => line.includes("#born"))
return ["[["".")[0]+"]]", lines]

//resolve the promises and build the table
Promise.all(arr).then(values => {
//filter out files without "Happy" and the note with the dataview script
const exists = values.filter(value => value[1][0] && value[0] != "[[dataviewjs-testing]]")
dv.table(["file", "lines"], exists)

NB: You need to add the ``` in front and after to test it in Obsidian.

Half way there
This lists all the lines with #born on them. But it’s listed by document, not sorted by year, and it doesn’t search for places/city names.

So any help, is appreciated. I’m oyvind on twitter if you want to send me DMs.

@Moonbase59 Maybe something you could have a look at?

I’m sure there might be some query that will fix this. But I’m looking for a much simpler solution. That often means changing some of the existing content. Depending on how many such entries you have, you might need to figure out a way to do that so consider that as an overhead. But the good part is it helps in the long run having that bit of a structured format as it allows a lot of flexibility later on.

The Solution I use: So I have many things I track in my daily notes for which I’d like a break down by day for the entire history of my journal. I use a tag #Watched for example to track anytime I watch something interesting online or a Movie/TV show. You can map that to your #born tag here. What I realised is we can combine a tag and a DataView inline field to work as one as long as it is the first word in a sentence. So in my daily notes I have,

- #Watched:: [[Inception (2009)]] for the 4th time with [[John Doe]]

Then I collect all these watched entries (works with multiple entries on a day as well), in a note called Watched Log which would be equivalent in your case to the Scotland note.

TABLE Watched 
FROM #Watched 
SORT file.ctime DESC

And this is what it looks like

Notice the day with multiple entries, it used to not work earlier but a while ago DataView was updated to support this which makes it possible now.

The only thing this requires is that #Watched:: is in the beginning of the line or else it won’t populate in the query.

If you are unable to change all your existing entries or for some reason choose not to, there’s another work around I think using the built-in Obsidian Query. I also have this in my Watched Log at the bottom,

tag: Watched

This gives a similar result sorted and grouped by date which looks very similar to what it’d look like in the search pane. The only issue is, you cannot have other columns or sort this list or collapse it. There is already a feature request regarding this and I’m sure sooner or later it would work exactly like backlinks and search so we can expect those abilities here. With the built-in query you might also want to look at the line: filter in the docs as that’s what allows you to search for the tag and Scotland both in the same line.

Good luck!



I’m using your setup (or very similar) for communications. I use it for calls, important emails etc, and then add that to each person’s note. Very useful!

For the #born thing, I’m trying to solve her, my aim is to see who were from where om the notes from that place. So in the Scotland note, I can see the names of the ones born there.

The bullet points on the year notes (“04-19” and so on), are in a chronological list, starting with ancient times, moving up to today. I could of course had each event in it’s own note, and then listed all those back to the main note. But it would increase the number of notes in my vault by 20-50x so I don’t want to do that.

I’m using the double colon to add values to be readable by dataview in my movies list too, for the ratings. Also in my genealogy reasearch where it’s super useful.

Does this not work if you use #born:: Scotland In your notes?

WHERE born AND contains("Scotland", born)

I works. But then I would have to format 366 notes to accomplish this. And change the whole way they are set up.

Yeah I understand. That was a caveat I mentioned early in my reply!

The way I handled changing everything from my past entries was doing them manually. I thought of doing it with a Shell script but then I wanted to make sure I review each change and my skill at writing regex is not that great. So I decided to just do it manually. And the way I’m doing it is that I have individual notes for each day collected into 366 files named like On this day - 07-12 which transclude the files from previous years chronologically. The link to this file is in my Daily Note template so I review this every morning. And since I could have only around 1-5 notes to review I only spend 2-3 minutes each day on fixing the formatting to suit my newer system. I am going to spend that time anyway reading those notes (a habit I got from using Day One for years), might as well sort of upgrade them with links and fields to fit my new system and make it more useful.

While I don’t insist that you try that. I understand your notes are different and probably longer than mine. But just putting this out there as one way of dealing with keeping the content more live while at the same time reviewing (and reflecting which is the point of journaling) old entries.

1 Like

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