What I am trying to do:
I use Obsidian to manage projects and tasks. I am in many meetings throughout the day, and for each meeting, I capture notes, action items, etc. The meeting note has an outlink to a project note. I also add outlinks for each task to “personnel” notes (for building agendas when I meet 1:1 with people), and to indicate who is the owner with a property, “[owner:: [[last-first]]]”, and to the project note(s) the task is for. (It’s not always for the project that is linked to the meeting.)
In my Daily Note, I have a table that shows a list of meeting notes for the day (each meeting note has YYYY-MM-DD in the title, just as the daily note does). For each meeting note row, I also want to show what projects are linked in the meeting note (i.e. the outlinks from the meeting note that link to project notes.)
Each project note has a “#project-description” tag in it, so I can filter all of the meeting note’s outlinks to just those notes that are project files.
This is my query:
TABLE
file.ctime
AS "Created Time",
filter(file.outlinks, (x)=> contains(x.file.tags, "#project-description"))
AS Projects,
!contains(file.tags, "#unprocessed") AS "Processed"
WHERE
file.day = this.file.day
AND
(
contains(file.tags, "#meeting")
OR
contains(file.name, "_mtg_")
)
SORT file.ctime DESC
The result looks like this:
The part in the red box is what I am trying to resolve. In that one row, there are obviously 6 outlinks from that one meeting note to the same project note (likely one for the meeting itself, and one for each of 5 tasks captured in the meeting note). The Projects field for that meeting note row in the table shows each of the outlinks, even though they are all the same.
I am trying to filter the contents of the Projects field to only contain unique values, so even if there are multiple links to the same project file, it would only display once. (I just want to show what projects are linked from the meeting).
Things I have tried
The query above is the result of a lot of trial and error and reading of documentation.
I am a software developer, so I can write Javascript, but I have not quite figured out the right approach to switching to dataviewjs yet, nor found how to filter that field to distinct values.
I see in the docs how to treat a DataArray object in dataviewjs (it’s an array with some extra functionality), and it mentions being able to apply normal array functions like “distinct”, but I haven’t figured out how to emit a table as the result of the codeblock, or how to apply the “distinct” function to a single column/field.
I could use a little direction, maybe an example?
Thanks!