Using Dataview(js) to find @person objects in a list of note attendees

What I’m trying to do

Please note, this was cross posted to: Plugin: Easily create links to people within your notes - #2 by ataylor

Where @person is an attendee of a meeting i.e.

Attendees

  • @person1
  • @person2
  • etc…

Is there any way to link the @person back to the meetings where that person was an attendee?

I am quite new with this, but looking at dataviewjs I can’t find any way to look for a note heading and the person objects under it.

Many thanks in advance.

Things I have tried

I’m unable to find a way to extract the heading (Attendees) or @person objects under it. I have tried getting the pages with:

let pages = dv.pages("#Meeting and -#Personal")
    .sort(n => n.date)
    .file.link
console.log(pages)

dv.list(pages)

Looking through the logged pages, I can’t see any obvious way to do this.

Maybe on page save if I can add each person to an attendees metadata field I could then search for that and get the list of values for the key?

Any ideas would be welcomed, many thanks in advance.

There is by default nothing special in Obsidian related to “@person”, so it sees that as the same add some other combination of letters.

As such there are no metadata related to those strings, and no easy way beside ordinary text searches to locate them. And dataview is not particular strong on text searches. Although you could trigger javascript and use that. Still a somewhat expensive solution.

If on the other hand you switched to either using tags and/or lists/tasks, it would making dataview searches easier and you could accomplish some of your goals.

Personally I tend to tag persons with some variant of “#P/JohnDoe”, and I’ve seen people using either plugins or emoji characters directly (or CSS) to make such tags stand better out.

And if you use a list/task item for a meeting, you could easily use subitems (or children) to see the meeting attendants. Various variations of this is found throughout this forum.

Put this in your person note and it will give you a nice table of all notes they were mentioned.

Change the dv.pages query to further filter if you want.

```dataviewjs
dv.table(
	["Note", "Location"],
	dv.pages("[[" + dv.current().file.name + "]]")
		// Sort by YAML created field, but check whether there are multiple created dates
		.sort(b => moment(Array.isArray(b.created) ? b.created[0] : b.created), 'desc')
		.map(b => [b.file.link, b.file.folder.replace(/\//g, ' ‣ ').replace(/^\d+ (.+)/, '$1')])
)
```

Huh? How will that scan the text or list items, AlanG, for the “@person” text? Have I misread the OP totally?

As far as I can tell, they’re not links, just text.

They’re links: “Easily create links to people within your notes”.

I failed to read that he was using that other plugin, and thought he wanted to use the literal “@person” as a link. My answer above is within that context, but given proper links (however they’re generated) you’re answer is succinct and to the point on how to link back to the origin of those links.

2 Likes

@AlanG Thank you so much!!

I’ll be able to test this tomorrow morning and will report back.

@holroy Apologies, I should have been more specific and detailed the plug-in being used.

Thank you both for taking time to respond and advise.

A very impressive and helpful forum. In time I hope to be able to give back to the community.

I couldn’t wait :grinning: so made the changes from my phone.

PERFECT!! The code has also given me enough to mess with filtering on date ranges and putting meeting summaries into the table.

Thank you again.

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