Hi, I tried to do it again. After a long search
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 .
- I chose TASKS (it could also be a LIST ) as a sort of container bounding all fields.
- 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.
- 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.
- 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.
- I struggled with grouping this query by a file.link. 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.
1.My TASKS
- [?] (bookmark_type:: “TO READ:”), [book:: Hobbit], [author:: Tolkien]
- [?] (bookmark_type:: “TO WATCH:”), [link:: youtube.com], [title:: We Learn SQL], [category:: programming], [subject:: SQL],
2023-08-15
- [?] (bookmark_type:: “TO GO:”) [festival:: Across The Universe], [rock_band:: The Animals], [folk_band:: Johnny Cash ], [ jazz_band:: Eva Cassidy]

2.My QUERY
```dataview
table without id file.link 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")

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