Is there a way to create an indented line for a subfolder within the grouped folder in list view?
I created an index of files grouped by subfolders in the top level project folder the index file exists. However, in the list generated, the second level of subfolders show up at the bottom of the list without any reference to the folder hierarchy. In my picture example, the “Research and Ideas” folder is actually a subfolder of “5 Create Product.”
I am very new, so if you know of a way this can be done without js, that would be especially great.
Here is my current code:
LIST
rows.file.link
WHERE contains(file.folder, this.file.folder)
GROUP BY regexreplace(file.folder, ".*\/([^\/]+)$", "$1")
Don’t know how to indent subfolders so have always used paths. Wonder if css could style the output into levels?
You probably know and have already ruled these options out, but in case you don’t and haven’t …
```dataview
LIST
rows.file.link
WHERE
contains(file.folder, this.file.folder)
GROUP BY
file.folder
```
```dataview
TABLE
rows.file.link AS Notes
WHERE
contains(file.folder, this.file.folder)
GROUP BY
file.folder
```
The regex you’re using is pulling out the last folder of the related folder, so it’s make sense that it appears somewhere in your list. I think I’d rather approach this slightly different, and that is to remove the folder of your index file, and then group on the rest of the folder.
```dataview
LIST
rows.file.link
WHERE startswith(file.folder, this.file.folder)
GROUP BY regexreplace(file.folder, this.file.folder + "\/", "")
```
How does that look to you? This will display all sub-folders as separate items, and keep sub-folders connected with their parent folders. It’ll start the list with any files residing in the current folder.
Bonus tip: How to present code properly in a forum post
If you want to showcase either markdown, or code blocks, or dataview queries properly in a forum post, be sure to add one line before and one life after what you want to present with four backticks, ````. This will ensure that any other backticks (like for code blocks) is properly shown.