Listing custom ("undefiend") dataview fields

What I’m trying to do

I find myself over end over trying to do sth like this in different situations. It seems doable but i can’t figure out how. I think, that basically, I’d like to have two kinds of dataview fields. Defined and undefined. So for example.

Let’s say I’m writing in my daily note that I’d like to go to a festival. Festival is defined, but bands are different every time a new festival is announced.
On festival_one plays: rock_band - A, folk_band-B and jazz_band-C.
On festival_two plays: disco_band-D and techno_band-E.
After some intense festival attendance, I want to make myself a playlist, from type of music I’ve listened to most often, through the year.
So, I sum up in a query all the festival entries with corresponding bands and this way I can see what I’ve liked the most.

Things I have tried

I’ve thought that I could do it with tasks. Query all tasks that have a festival field (or maybe tag) in them and list all other custom fields inside this task. I’ve managed to list all fields in the task (with flatten rows.file.tasks), but this includes also implicit fields like date, description etc. and doesn’t exclude the empty fields.
Is there a way of achieving something like this. I feel it must be ether very, very easy or impossible. I don’t mind methods other than dataview. Maybe tags, some plugin, nesting one dv field in another, dataviewjs (although it would be most tricky since I don’t know java script)?

I’d really appreciate help cause I’ve already got stuck on this a few times. I guess my brain naturally try to gather information in this specific way.

Hi, I tried to do it again. After a long search :slight_smile: I didn’t exactly solve it but I’ve managed to come up with a little workaround. Maybe it could be useful to somebody.
First I tried with nested dataview fields. Some people on the Forum said it works, some that it doesn’t. I couldn’t apply it, because those nested fields rendered correctly visually, but weren’t searchable. I thought I could cheat a little with something like object() but as is explained here:How do I search according to an object field and its key value by holroy, probably it’s not possible either.

Ultimately, I used a kind of approach described by holroy and mnvwvnm in this topic:: Dataview -> extract only matched Line from Page .

  1. I chose TASKS (it could also be a LIST ) as a sort of container bounding all fields.
  2. I decided to define the first field, always as bookmark_type, to search by it. The bookmark’s key and following fields will change depending on a situation. My problem was extracting those fields from tasks.text as an array, so they were easily readable. I was looking for sth like file.tasks.key, file.tasks.value, because I saw similar expressions in dataviewjs scripts, but if I understand correctly, they don’t exist in normal dataview queries.
  3. The solution I found is a function, split after a coma - split(“string”,“,”). It’s not ideal, I assume they are still a string, but I think for my use, a visual list will be enough.
  4. Ideally, I’d have a bookmark_type only in a separate column, without it being repeated under “my bookmarks” header. Or don’t show additional inf like task’s creation date. But, I can live with that.
  5. I struggled with grouping this query by a I don’t know what I did wrong, but actually, with a lot of bookmark entries, it may be more readable the way it is.

With this method, all dataview objects seem to work fine. The only catch is you need to access them via flatten tasks and rows.

I think this will work for me, but of course, I’ll be happy to listen to any other possibilities or improvements.

So here’s the query.


  • [?] (bookmark_type:: “TO READ:”), [book:: Hobbit], [author:: Tolkien]
  • [?] (bookmark_type:: “TO WATCH:”), [link::], [title:: We Learn SQL], [category:: programming], [subject:: SQL], :heavy_plus_sign: 2023-08-15
  • [?] (bookmark_type:: “TO GO:”) [festival:: Across The Universe], [rock_band:: The Animals], [folk_band:: Johnny Cash ], [ jazz_band:: Eva Cassidy]

Bez nazwy-1

table without id as "source note", t.bookmark_type as action,  split(t.text, ", ") as "my bookmarks"
from #this_note
flatten  file.tasks as t
where contains( t.text, "bookmark_type")

Bez nazwy-2

  1. All fields seem to be searchable.
table  rows.t.festival as festivals, rows.t.rock_band as "best rock_band", as books
flatten  file.tasks as t
where !=null or t.festival !=null or t.folk_band !=null 
group by as "From my bookmarks"

Bez nazwy-3

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