I’m trying to create a table that compares different values of certain fields across notes, but I need the notes to be columns and the fields to be rows.
Think of a “product comparison table” where the first column contains the field names found in all eligible notes, and all other columns are each a note. Each note (column) should show the field values from that note.
Since there is only a small number of notes (columns), and each note has a potentially long list of fields, I need the notes on the x axis and the fields on the y axis, otherwise I end up with a table with 3 rows and 80 columns… that’s the reason.
The relevant part of a note looks as follows. It contains inline fields that each have a value.
I picked a movie note type for this example for simplicity.
- year:: 2021
- genre:: action
- runtime:: 80 min
- country:: USA
- year:: 2021
- genre:: scifi
- runtime:: 1.5h
- country:: Argentina
- score:: 4
The dataview table should look like this:
|field||Note A||Note B||Note C|
|runtime||80 min||1.5h||120 min|
- each note a column
- each field a row
table without id year, genre, runtime, country, score from #movie
This yields the data I’m after, but with inverted columns/rows: the fields are each a column and the notes are rows. I need it the other way around.
Bonus points if you can additionally show me how to dynamically feature all fields from the set of notes without writing each one out in the query.
I tried a number of different queries and scoured the forums and web for a hint, without any luck so far.