DataviewJS filter a grouped table to only show results with a specific backlink

What I’m trying to do

Trying to create a grouped table that only displays notes that contain a backlink in the frontmatter from a specific folder. So it filters out the tables to only include the ksb that I specify. E.g. it only displays notes with the K2 link:

Things I have tried

I currently have the following which works in displaying the grouped table based on the Module:

for (let group of dv.pages('"University Learning"')
.groupBy(m => m.module)){
	dv.header(2, group.key);
	dv.table(["Lecture Notes", "Date"],
		group.rows
			.sort(l => l.date, 'asc')
			.map(l => [
				l.file.link,
				l.date
			]
		)
	)
}

What I tried based on some help forums but don’t work:

for (let group of dv.pages('"University Learning"')
.where(k => dv.func.contains(k.ksb, dv.func.link("K2")))
.groupBy(m => m.module)){
	dv.header(2, group.key);
	dv.table(["Lecture Notes", "Date"],
		group.rows
			.sort(l => l.date, 'asc')
			.map(l => [
				l.file.link,
				l.date
			]
		)
	)
}

It should not display the notes with the cross as they don’t have the k2 link:

Any help is greatly appreciated :slight_smile:

I tweaked some things and fixed it, not sure what i did differently but can’t complain

for (let group of dv.pages('"University Learning"')
    .where(k => dv.func.contains(k.ksb, dv.func.link("K2 - Materials and manufacture")))
    .groupBy(m => m.module)) {
    dv.header(2, group.key);
    dv.table(["Lecture Notes", "Date"],
        group.rows
            .sort(l => l.date, 'asc')
            .map(l => [
                l.file.link,
                l.date
            ])
    );
}