Show Task depending on fields in the notes

Things I have tried

I have tried using dataview and dataviewjs to create a query for my templates - but I cannot find a way to combine tasks and field information.

Task 
where organisation = "XXX"

Which gives the right results, but I get links to all the files too:

Notename
  - [ ] action 1

Nextnotename
  - [ ] action 2
  - [ ] action 3

I just need a simple list of all tasks I can put in a callout. No headers, no notenames.

What I’m trying to do

I am building a system for project notes. Every meeting note has fields (now in frontmatter), with at least:

  • organisation
  • project

I typically create notes within a project. Now, I want to create a callout on every note page for all open tasks for this project; so, on a note show ALL open tasks for organisation xxx and project yyy.

To visualise this:

---
organisation = XXX
project = YYY
date = 2022-01-01
---

would be the frontmatter.

Then, on the bottom a callout:

Tasks

  • [ ] action 1
  • [ ] action 2
  • [ ] action 3

where those 3 actions are in other meeting notes with also organisation = XXX / project = YYY.

I can find lots of references to using tags in my tasks, but I do not want that - I really want to use fields. And, preferably dataviewjs queries because someone just explained to me how to include them from separate .js fields.

I suspect the problem can be solved in dataviewjs by first creating a var from a query with the where clauses. And then, on the remaining files, perform a query to get all the tasks.

I just do not know nearly enough about the structure and syntax to create this myself.

```dataviewjs
dv.taskList(dv.pages().where(p => p.organization === "xxx").file.tasks, false);
```

is a translation of your query at the top of your file into dataviewjs with a bonus “false” parameter at the end to get rid of the grouping by file and make it a single list. (I wish I knew how to get rid of the grouping in plain dataview query language. I know how to add the grouping to a plain Task query, but not the other way around. Anyway, you said you were more interested in JS for multiple reasons.) Note that if you copy-paste the code-block from the forum you might get a bunch of extra ` symbols to delete due to the quirks of displaying code here.
Hope this helps get you started, and feel free to post back if you need more guidance!

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