Accumulate data from tagged lines

Hi everybody! I’m fairly new to Obsidian but already love it and all the plugins.

Things I have tried

data-view and charts

What I’m trying to do

Accumulate data from tagged lines across my vault.
For example, I want to be able to parse lines (list items) that contain a specific tag.

- #fitness running 6.00km in 33:30m

The motivation is to parse the data and build graphs and summaries from it.
monthly average, etc.

From what I’ve seen, data-view seems to be only operating on a page or task basis.

Any ideas how to accomplish this?

Cheers,
Martin

1 Like

Maybe you could try using tasks since you can query tasks by tags, storing your data via inline metadata syntax, but I’m not exactly sure if it is possible to have dataviewjs manipulate the stored data and display results in this way. It would seem that if this technique is not possible that there is likely another way. I’d be very interested to hear how it could be accomplished. You might want to ask on the Dataview GitHub as well. I received some very useful guidance there before. That being said, I have a feeling the answer is already posted somewhere on this forum, or someone will respond soon with a solid answer.

Good luck! Thanks!

You could try obsidian’s inbuilt query blocks

```query
#fitness
```

You’ll get line-wise dynamic results, but I’m not sure if you copy or manipulate the data in any way.

1 Like

My answer isn’t related with graphs or similar, only about the way you can play with lists items in dataview.
Related with metadata structure, lists work as tasks. This means that you can query for lists based in data at lists level.

Take in consideration examples bellow:

note 1

- #fitness running 6.00km in 33:30m
- other thing

note 2

- #fitness running 5.00km in 26:30m
- other exercise 

the query

TABLE replace(Li.text, Li.tags, "") AS Fitness
FROM "your-folder-path"
WHERE file.lists
FLATTEN file.lists AS Li
WHERE contains(Li.tags, "#fitness")

(adapt FROM "your-folder-path" with your real folder path. you can also add a tag to a more accurate source filtering FROM "your-folder-path" AND #fitness)

results

3 Likes

Thank you @mnvwvnm and @shallash !

This already got me closer to what I want to achieve. Now I at least have the data that I want.
Just need to manipulate it (possibly with dataviewjs) and pass it to the graph.

I’ll work on it when I find the time and post here with my results.