Remove double entries from group by list

Things I have tried

My current idea is:

	project AS "Projects",
	rows.sub-project AS "Subprojects"
FROM "Projects"
WHERE project
FLATTEN sub-project
GROUP BY project

I also looked in the dataview GitHub pages for a function or similar, though I could not identify anything that helps.

Also I tried the solutions shown here, as it is kind of similar as what I want to do. However,

  • I do not like the visuals of the output
  • I do not know how to filter out the undefined projects, i.e. I do not know the js equivalent to my WHERE project
  • I have no clue how to customise js, as I do not know that language. Thus, I am inclined to avoid any js solutions
  • I also don’t really get the dataview solution presented there…

What I’m trying to do

My solution from above leads to a list of subprojects per project including many instances of the same subproject. I want to reduce that list, so that it is basically a table showing projects, and a set of the subprojects. E.g. in python, I would just use set(rows.sub-project).

My overall goal is simply to make an overview over my projects and their subprojects. Being able to also display respective files like in the linked forum discussion would only be a bonus and not really necessary, as I could write a separate query for that.

It would be helpful to see some of your base data, and the result of your current query, and how you would like for it to look. I’m sure its doable, but we’re not mind readers able to understand how you’ve set up your data structure based on the information you’ve given so far.

The only thing I can relate to is the WHERE project equivalent, and that would be something like

  .where(p => p.project)

Assuming we’re working with a page object, that’ll check for the preference of a project field in that page.

I’m not quite certain if dataview do have any alternatives to getting just the unique values of a given list. I’ve not located any such method yet.

You’re right. Here some detailed information:

  • I have a folder called “Projects”, containing daily notes
  • Each note is connected to one or several projects, designated in the YAML via the “project: NAME” key-value pair
  • There is usually also a sub-project connected to a daily note, designated by “sub-project: NAME” in the YAML

Example YAML from the daily notes located in the “Projects” folder:

tags: project/lab-journal
note-type: "lab-journal"
project: ["MiLD"]
sub-project: ["MOMBAQ"]

For overview-purposes, I want to display all projects and their respective sub-projects in an overview file. Thus my query above, which should search the “Projects” folder for “project” and “sub-project” values. Currently, my output looks like this:

But it shows every mention of a sub-project existing in daily notes… I think another groub by command would reduce the output from the sub-projects, but I don’t know how to correctly implement it.

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