Multiple key-value pairs (key1-value1, key1-value2, etc.) in a single note

What I tried

Embedding multiple entries like below in a single note, then using dataview to extract them in a new note.

Input - in daily notes, I have a section for a log like this:

positive:: Curry.
	emotions:: Joy.
	needs:: Comfort.
	traits:: Can cook!

positive:: Curry again.
	emotions:: Still joy.
	needs:: So good...
	traits:: Can really cook!

Output - in a note summarizing all my positives, I have an entry:

TABLE WITHOUT ID positive as "positive", emotions as "emotions", needs as "needs", traits as "traits"
FROM "10_Daily_Notes/Entries"
SORT date(filename) desc

This results in a table where all entries from a single Input note are rendered in a single row of a table in the Output note.

What I’m trying to do

Have a table in the Output note where each entry from an Input note is rendered as a separate row.

Rationale

I dislike logging data into tables, so I’d rather log stuff in daily notes, but I’d like to be assured that if I want to export the data for analysis later, I can transform it into a CSV / Excel table. I’m open to learning and using a simple script e.g. in Python rather than Dataview, if that makes more sense.

Hi.
Related to Dataview, you can’t use this kind of metadata structure because it doesn’t work in the logic of groups.
The metadata of your example is read in this way:

positive:
  - Curry.
  - Curry again.
emotions:
  - Joy.
  - Still joy.
needs:
  - Confort.
  - So good...
traits:
  - Can cook!
  - Can really cook!

As you can see, you don’t get groups, but fields arrays. What aggregates this metadata is the page/note/file (this is why you get the results in the same row).

To check how/which metadata is organized in a specific note you can use this inline js query:

`$=dv.span(dv.current())`

Thank you! I’ll look into a simple script outside Obsidian for archiving / analysis, then, and use Dataview as a convenient way to view the data within Obsidian.

Remember: you can use a csv file in your vault as a source for your dataview query.

1 Like

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