To follow GTD, is there a way to have report that show all tasks with same @context

I have been trying to figure out a script to have a report of tasks with same context. For example all tasks that have @ email together and same with @phone etc. This would allow for good GTD implementation and focus on one context. I do at the moment but via copy and paste into new file which is a pain.
Ideally, the report would look like this

email :

  • task 1 @email @high (project …)
  • task 2 @email @low (project …)

phone :

  • task 3 @phone @today (project …)
  • task 4 @phone @… (project …)
    and so on.

I would appreciate it very much if someone can assist.

I have been using the following script which is good for one task but can it be used to create the report above ?


(() => {
    'use strict';
    // main :: IO ()
    const main = () => {
        const ds = Application('TaskPaper').documents;
        return 0 < ds.length ? (
            ds.at(0).evaluate({
                script: tp3Context.toString(),
                withOptions: 
				
				
				{
                    itemPath: '//@email and not @done'	
				
                }
				


            })
        ) : 'No documents open in TaskPaper'
    }

    // ----------------- TASKPAPER CONTEXT -----------------
    const tp3Context = (editor, options) => {
        editor.itemPathFilter = 'except //*';
        editor.outline.evaluateItemPath(
            options.itemPath
        ).forEach(
            x => editor.forceDisplayed(x, false)
        );
        return options.itemPath;
    };



    return main();
})()

If I have understood correctly what you are doing, then a script should not be necessary – a saved search in the sidebar should be enough.

You can define the particular subset of lines that you want to see in that search, in terms of the tags (and perhaps tag values) that they have, in the pattern of the Taskpaper search syntax.

1 Like