Here are a few dataview queries I worked out that allow open tasks to be queried matched to the name of the file name the query is ran from.
USE-CASE
Say you you have a note for each person in your contact list. These people are linked as required into different project notes essentially forming a team, teams vary between projects. So by have a folder full of POCs it allows you to easily link them into the project team…
Now as the project goes along folks are assigned tasks. With the scripts provided here you can run queries on tasks and get the results in a task or table formatted output.
Which ever script format you prefer should be added to a template that you use to create your POC notes. Then each time you visit the POC note (which you would typically do from a team member list in the project level note) you will get a report or any open tasks assigned to that individual.
EXAMPLE TASK DATA SET (file name)
REMOVE EXTRA O’s “OWNER” TO SEE RESULTS IN QUERY
[0000OOWNER:: “JON DOE”]
-
THIS TASK HAS A META DATA FIELD NAMED “OWNER” [OWNER:: JON DOE]!!!
-
THIS TASK IS AFTER THE “OWNER” META DATA TASK
-
#JON_DOE, THIS TASK HAS A “JON_DOE” TAG!!!
JON DOE (file name)
NAME: JON DOE
COMPANY:
LOCATION:
PHONE:
EMAIL:
POC INDEX:: [[REPORT - POCs]]
Projects Associated With
PROJ_IDs:: PROJ_ID_1, PROJ_ID_2, etc . . .
Note project IDs can be entered with or without commas. The use of commas will force a line return in the POC report
Notes
Outstanding Tasks
EXAMPLE OF USING METADATA IN THE FILE TO QUERY INCOMPLETE TASKS >> REMOVED FROM SAMPLE DATA TO GET EXAMPLES BELOW TO WORK PROPERLY, JUST ADD THE OWNER PROPERTY TO TEH FILE TO SEE THE RESULTS . . .
table file.link as "File Name"
from ""
where OWNER = this.file.name
CAVEAT TO USING THE FOLLOWING TECHNIQUES, IF THERE IS A “OWNER” METADATA PROPERTY IN THE FILE BUT OUTSIDE A TASK LIST ALL THE INCOMPLETE TASKS IN THAT NOTE WILL BE INCLUDED INSIDE THE QUERY RESULTS, ALBEIT ONE WOULD TYPICALLY NOT FORMAT A NOTE IN THIS MANNER. . .
EXAMPLE OF USING METADATA TO QUERY INCOMPLETE TASKS
task
from ""
where OWNER = this.file.name and !completed
EXAMPLE OF USING TAGS TO QUERY INCOMPLETE TASKS
task
from ""
where contains(tags, replace(this.file.name, " ", "_")) and !completed
EXAMPLE OF RETRIEVING TASKS THROUGH A TABLE QUERY VS A TASK QUERY, NO FILTERING APPLIED . . . .
TABLE Task.text as "Task"
FROM ""
FLATTEN file.tasks as Task
WHERE !Tasks.completed
EXAMPLE TO RETRIEVING TASKS THROUGH A TABLE QUERY
VS A TASK QUERY WITH METADATA PROPERTY FILTERING APPLIED . . . .
TABLE Task.text as "Task"
FROM ""
FLATTEN file.tasks as Task
WHERE !Tasks.completed and Task.OWNER = this.file.name
EXAMPLE TO RETRIEVING TASKS THROUGH A TABLE QUERY
VS A TASK QUERY WITH TAG FILTERING APPLIED . . . .
TABLE Task.text as "TASK"
FROM ""
FLATTEN file.tasks as Task
WHERE contains(Task.tags, replace(this.file.name, " ", "_")) AND !Task.completed
Hope these helps folks by saving them some time
Best Regards
-Tim C.