Some help with splitting out a dataview query

Hi - I’m trying to create a dataview using blacksmithgu’s Dataview plugin that will allow me to create a list of something in multiple files, and in another I can retrieve the lists from all files.

In file A I have

Command:: pwd
Description:: Show’s current directory

Command:: ls
Description:: Lists files/folders in current directory

Command:: cd
Description:: Navigate to a folder
Use:: cd /home/user/Documents

In file B I will have more of these as I’m learning and so on

And in File C I have

command as Command,
description as Description,
Use as Use
FROM "Work 2.0/Education/RedHat"
FLATTEN rows as R
SORT R.Command ASC
WHERE contains(Command, "")

This displays mostly correctly, however as there is three entries for File A it combines them under File A, and the Use of cd is centralised and appears in my table as if it’s connected to ls (you can view the output as I’m seeing at Screenshot-2023-03-02-at-12-59-36 hosted at ImgBB — ImgBB)

My question is - how can I split these so each Command:: Description:: Tag is on different lines, or can I not?

If not, how can I best go about achieving what I’m trying to? :slight_smile:

Thanks in advanced!

If you search the forum you’ll see loads of mention as to how your fields as related to page scope, so that all the values are collated into field lists. To counter this you need to move your fields into list items. In other word you need to change your syntax to something like

- [command:: pwd] — [description:: Shows current directory]
- [command:: cd] — [description:: Navigate to a folder]
  - [use:: cd /home/user/Documents]

This will allow for queries like:

TABLE cmd.command as Command, cmd.description as Description
FROM "Work 2.0/Education/RedHat"
FLATTEN file.lists as cmd
WHERE cmd.command
SORT cmd.command ASC

A little unsure, as I didn’t test this, whether you should include the use field on the line, or whether you should grab that from the children list… It’s a little depending on use case, and how you’d like to visually present stuff.

The main thing, is that you need to use fields within a list (or task) scope to properly group them together as part of the same structure. And use that as the base of your workflow.

Note that the lists doesn’t need to be kept together in the file, you can have the commands scattered throughout the file, but each of them need to be in a bullet point of its own.

Thank you, that worked almost flawlessly (I also included cmd.use as Usecase and that worked perfectly also)

The formatting isn’t ideal in my File A, B etc… but it’s definitely something I can live with, so thank you for that :smile: