Hello all, I hope you are having a good day and thank you for reading! Now without further adieu…
What I’m trying to do
I am trying to surface the text in a note that ends with #question using Dataview. I would like it so that every row in this Dataview table contains the full line that proceeds a tag of #question. So for a file that has this:
- Here’s an example:
- Blah
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
- Blahblah
- This line should be returned as a row #question
- Blah
Dataview can identify files that have a certain tag, but cannot return the strings in those files that end with the tag.
Things I have tried
So first, this query successfully returns files that contain the tag:
table file.name AS "Note"
where contains(file.tags, "#question")
The issue is returning the substring in that file which precedes the tag. I have tried this query:
table substring(file.content, 0, 500) AS "Content"
where contains(file.tags, "#question")
I have also tried more complicated queries, such as:
table file.cday as "Created", substring(file.content, 0, 500) as "Snippet"
from "Self"
where regexmatch(".*#question$", file.content)
But for some reason, none of these surface the content that ends in #question.
Why is this? What am I doing wrong?
Also, the file looks something like this attached file:
Test Doc.md (1.1 KB)
If there is some change I can make to the way I write my notes that would make them easier to query, I am more than happy to do this. Any help is appreciated and thanks for reading (・ω・)ノ