Dataview to show tags and the line of text within which they are found

What I’m trying to do

Create a dataview thingie that lists each line of text which contains the tag #sometag

Things I have tried

I tried chat GPT and it kept suggesting this:

list from #sometag
flatten file.tags, 
file.line(tag)

But that doesn’t work, error:
Dataview: Error:
– PARSING FAILED --------------------------------------------------

1 | list from #tv

2 | flatten file.tags,
| ^
3 | file.line(tag)

Expected one of the following:

‘(’, ‘*’ or ‘/’ or ‘%’, ‘+’ or ‘-’, ‘.’, ‘>=’ or ‘<=’ or ‘!=’ or ‘=’ or ‘>’ or ‘<’, ‘[’, ‘and’ or ‘or’, /FROM/i, /[0-9\p{Letter}_-]/u, EOF, FLATTEN [AS ], GROUP BY [AS ], LIMIT , SORT field [ASC/DESC], WHERE , text, whitespace

I don’t think DataView can do that. Check its documentation. ChatGPT gives bad advice about Obsidian.

A simpler way to do this is an embedded search:

~~~query
tag:sometag
~~~
1 Like

thats exactly what I’m looking for, thanks!!

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