Sorry, I couldn’t find a clear way to describe my problem in the subject line of this post.
But what I’m trying to do is:
- Create a table of literature notes from
directory_a
- Make a column that holds a list of all files in
directory_b
with backlinks to each file/row fromdirectory_a
The files in directory_b
are syntheses of multiple literature notes that use backlinks to the source material. These syntheses typically have a many-to-many relationship with the directory_a
files.
The table I have write now is very basic, whether created using DQL or dataviewJS. E.g.,
dv.pages('"path/to/directory_a"').map(p => [
p.file.link,
p.Title,
p.Author,
p.Year,
p.Claims]))
Were I trying to put together something roughly equivalent to what I’m trying to accomplish using JSON, I’d might use nested for
loops, with the outer iterating over directory_a
and the inner over directory_b
, evaluating for instances in which directory_b[j]
contains a backlink to directory_a[i]
, and appending a backlink to directory_b[j]
to an array of values corresponding to a key referenced_by
in the JSON object for `directory_a[i]. There are alternative ways to accomplish this, of course, but I hope this communicates the general idea of the relationships between the files/directories and how I’m trying to treat/create cross-references between them - but instead of JSON objects, I’m dealing with Dataview table rows.
I feel like there must be a fairly straightforward way to do this using dataviewjs, but despite having a passing familiarity with Javascript, I’m still trying to wrap my head around a lot of the dataviewjs syntax. Someone I spoke with suggested I just needed to use the WHERE
function in DQL to accomplish this, but that didn’t seem to work, and I’m pretty sure WHERE
acts on what FROM
returns, and the backlinks in directory_b
files aren’t contained within the files in directory_a
from which the FROM
function pulls the table rows. But if there’s a way to do this with DQL, I’m definitely open to that, too.
I also tried creating an inline property within each given literature note called referenced_by
that automatically populated itself using an inline dataview query. I got it to sort of work with =this.file.inlink
, but couldn’t figure out how to use an inline query to restrict the returned files to those contained within directory_b
. And even so, when I tried to include the unfiltered, query-populated referenced_by
property as a table column, the cells in that column ended up rendering with the value of <empty string>
.
I could obviously just manually add a backlink to each directory_b
file to a frontmatter property in each corresponding directory_a
file, but my goal here is to streamline and automate as much of my workflow as possible, and being able to skip that step would be very, very nice given the quantity of literature notes and syntheses I’m working with.
Any help is appreciated, thank you for your time!