I am trying to make a dataview tables that list university notes with various subject codes represented as tags, and group by their parent folders with names only displaying their parent folders names, or (preferably) by just removing “University/Subject Notes//” from the groups title.
Things I have tried
I currently have this solution implemented, which does all the features necessary, but results in the entire folder path being printed as the group headings.
I’ve tried using str.substring() on the group.key in line 2, but this caused an error and I have near zero javascript experience so I doubt that was even remotely the correct syntax hehe
for (let group of dv.pages("#HAS120").groupBy(p => p.file.folder)) {
dv.header(2, group.key);
dv.table(["Name", "Creation Date"],
group.rows
.sort(k => k.ctime, 'desc')
.map(k => [k.file.link, k.file.ctime]))
}
god im realising so many poor grammar choices in this, if i can edit, idk how, but heres some clarification
in the first paragraph, when im talking about “only displaying their parent folders names” I’m referring to the headers for each group, and my desire to name them more succinctly, currently the header displays “university/subject notes/subject code/parent folder name/”
i wish to have the headers display without the “university/subject notes/insert subject code here/” portion of the statement. so that the header title would just be parent folder
That is true about slice(-1), but I used the offset from start since that was what you asked for, and it would allow for sub folders after the first two.
The key point being just be aware of the difference of asking for all folders after the two first, vs the last folder in the list. Both are very useful in their own use case.