Unpacking dataview values nested under multiple levels?

What I’m trying to do

For my CD/MP3 collection, I want to list the title of each track for a given album (as well as a few other things). The YAML that I built for this has several levels of nesting. (e.g., An album can have one or more discs. Each disc can have one or more tracks. Each track has a title. )

I can get this list of titles, but it is very messy.

The YAML looks like this:

artist: Beatles
album: 99 Past Masters-Disc 2-2009 Stereo Remaster
year: 2009
genre: Rock
discs:

  • disc:
    • discId: 1
    • tracks:
      • track:
        • track: 1
        • title: Day Tripper
        • comment: Track 1
        • beginning: 0
        • length: 1.69195e+11
        • bitrate: 201
        • samplerate: 44100
        • bitdepth: -1
        • url: file:///home/scott/Music/Beatles - 99 Past Masters-Disc 2-2009 Stereo Remaster/Beatles - 99 Past Masters-Disc 2-2009 Stereo Remaster - 01 - Day Tripper.mp3
        • filesize: 4.272128e+06
      • track:
        • track: 2
        • title: We Can Work It Out
        • comment: Track 2
        • beginning: 0
        • length: 1.35497e+11
        • bitrate: 198
        • samplerate: 44100
        • bitdepth: -1
        • url: file:///home/scott/Music/Beatles - 99 Past Masters-Disc 2-2009 Stereo Remaster/Beatles - 99 Past Masters-Disc 2-2009 Stereo Remaster - 02 - We Can Work It Out.mp3
        • filesize: 3.377152e+06

…and so on…

Note: This YAML may be overly complicated, but (1) it is recognized by Obsidian as valid, and (2) it is a learning exercise for me. :slight_smile:

Things I have tried

This:

= this.discs.disc.tracks.track.title`

Produces this:

-, -, Day Tripper, -, -, -, -, -, -, -, -, -, We Can Work It Out, -, -, -, -, -, -, -, -, -, Paperback Writer, -, -, -, -, -, -, -, -, -, Rain, -, -, -, -, -, -, -, -, -, Lady Madonna, -, -, -, -, -, -, -, -, -, The Inner Light, -, -, -, -, -, -, -, -, -, Hey Jude, -, -, -, -, -, -, -, -, -, Revolution, -, -, -, -, -, -, -, -, -, Get Back (With Billy Preston), -, -, -, -, -, -, -, -, -, Dont Let Me Down (With Billy Preston), -, -, -, -, -, -, -, -, -, The Ballad Of John And Yoko, -, -, -, -, -, -, -, -, -, Old Brown Shoe, -, -, -, -, -, -, -, -, -, Across The Universe, -, -, -, -, -, -, -, -, -, Let It Be, -, -, -, -, -, -, -, -, -, You Know My Name (Look Up The Number), -, -, -, -, -, -, -, -

This:

table without id
t
flatten (discs.disc.tracks.track.title) as t
where file = this.file

produces this:

Day Tripper

We Can Work It Out

…and so on…

I have googled dataviews and nested lists. I read the documentation on dataviews on the Obsidian’s and the author’s websites. I searched the topics on this form, but I am missing something. Please point me in the right direction.

Thanks.

I appreciate several people having looked at this topic. As an update, I have figured out what I was doing wrong. Any comment is still welcome. :smile:

The YAML I created is not “wrong,” but I treated all the nested elements as list items (by prefixing the line with a dash). So when I queried the “title” field, Dataview returned the title value with the list it was “packed” in. By removing the unnecessary dashes, I got the clean list of values I sought. :smile:

I also had another gaff in the YAML: I made “track” a sub-element of “track.” That was an out-and-out typo. The sub-element was meant to be “trackId.”

Thanks.

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