The idea was correct, but the implementation was not up to par, so here is another version of this which make the fourth column (aka r[3]) presumably consisting of links into a unique list of links.
```dataviewjs
const result = await dv.query(`
TABLE type, summary,
filter(file.outlinks,
(o) => contains(o.file.folder, "persons")) as person
FROM [[]] and -#TaskExclude and -"templates" and -"cases"
sort file.name desc
`)
if ( result.successful ) {
const values = result.value.values
values.flatMap(r => {
const seenLinks = {}
r.uniqLinks = []
// Change the column index, if needed
r[3].forEach( l => {
if ( l.path in seenLinks ) return
seenLinks[l.path] = 1
r.uniqLinks.push(l)
})
})
dv.table(
result.value.headers,
values.map(r => [
r[0], r[1], r[2], r.uniqLinks
])
)
} else
dv.paragraph("~~~~\n" + result.error + "\n~~~~")
```
The code should in theory be reusable for other queries, and the changes one would need in that case are:
- Replace the query at the top with the query of your choice
- Change the column index around the middle of the query to the column of the list of links you want to make unique. Remember that the first column is
0, so the fourth column is3 - Replace the column list within the
dv.table()call near the end to match your query, and replace the link column, e.g.r[3], with the unique list, e.g.r.uniqLinks