How to aggregate lines from a file containing a specific tag?

What I’m trying to do

TL;DR: I would like to aggregate all lines of FILE1 that contain #TAG1 as a list in FILE2.

Hi everyone, with Zotero Integration, I get a nice file (e.g. arnaboldi2015-annotations) for every paper where all my annotations have tags based on the color of the annotation in the PDF. As I might need to re-generate these files if I change the PDF annotations, I can’t write comments in obsidian directly into the files, so I create a second file per paper (e.g. arnaboldi2015) and now I would like to have one list per annotation category (meaning per tag) in this second file for a fast reference.

Things I have tried

This is a solution that seems close to what I wish for but unfortunately only works with lists. And from what I gathered there, my request does not seem possible with dataviewjs as there is no way of obtaining the contents of a file.
So far, I have gathered a few pieces but as I am not proficient in JS, I wasn’t able to piece them together:

  • Here it is explained how the content of the current file can be read.
  • Dataviewjs code that gets me the annotations page that I am looking for looks like this: dv.pages().file.where((f => & ( != dv.current()

Could you please point me at how this file content aggregation could look like?
(I would like to avoid converting annotation files to lists as this would remove quote blocks and also have other limitations for readability)

1 Like

file a top of image: editing left; reading right.

file b bottom of image: source left; reading right.

A simple query in file b can extract the paragraphs in file a that contain a specific tag.

file:"file a" 

Would this suit your needs?

Source: How to recall several sentences from several notes in one place? - #7 by efemkay

1 Like

Oh wow, it really is that simple? Thank you! With file:“{{title}}-annotations” it can even be used in a template :star_struck:

1 Like

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