Dataview with Grouping as Header

hey there,
I created this dataview with java script.

As you can see there is a heading or grouping “A” which groups all the pages regarding a certain information provided in the yaml header. In this case Importance = A. Below Importance B and so on is listed.

However, i wondered if those groupings are also possible with dataview without js? I have checked the ressources of dataview: Structure of a Query - Dataview

but grouping does work differently here.

I want to solve this, as I want to create dataview in which i want to see files which are linked to another. e.g. from [[Homework]] and [[University]]. And I want to group for subjects.
I am not able to use dataviewjs since i do not know how to query linked pages in dataviewjs.

Can somebody help? :wink:

Thanks in advance.

Can you share the dataviewjs code you use for this ? it will be simpler to convert it to dataview.
There is actually a Group by command in dataview.

here we go :slight_smile:

let days = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];

let pages = dv.pages("")
		.where(p => !p.done && p["due_date"] && (p["due_date"] >= dv.date("today") || p.due > dv.date("today")));
		
for (let group of pages.groupBy(p => p["importance"])) {
	dv.header(5, group.key);
	dv.table(
	["File", "day", "due_date"], 
		group.rows
		.sort(p => p["due_date"], "asc")
		.map(p => [
			p.file.link, 
			days[dv.date(p["due_date"]).weekday - 1],
			p["due_date"].toFormat('dd.MM.yy')
			])
);
}

I don’t think that’s currently possible using a pure DQL query, but I’ve written some boilerplate code which can be used in this case.

In that answer I’ve tried to explain how you can build a query, apply some javascript around it (which doesn’t need loads of changes) to produce headings when a column changes value.

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