Dataview Help: Cannot get parent task text or section link for context in grouping or table query

Hi, im trying to make a daily task system based on GTD. I used to work in Evernote but that thing became useless quite some time ago. Now is unbearable and a total time sink. Ive decided to give Obsidian a shot. Im quite impressed with its powers.

I used a GTS system based with tags (what/when/who/where) and folders (inbox, pending, completed, reference).

Then i used quick saved searched for a lot of things (“now” tasks, “home” tasks, etc ). I mainly used the inbox to dump any new idea, email, task, research i need to do, etc and then sort it out. If what i need to do had more than one task, i created a proyect note and linked to the individual notes for each task with their apropiatte when and where context tags.

All this can be much more efficient in Obsidian using a few plugins, just one note and the tagging each task inside the main note.

But i have encountered with a problem. Lets say i need to build a wooden cabinet for the kitchen. I create a note called “Proyect - Build Kitchen Cabinets”. If i follow this structure

- [ ] Main task (eg: buy wood)
     - [ ] sub task 1 (eg: Find supplier) #now #pc
     - [ ] subtask 2 (call supplier) #next #phone

or

# Main task (eg: buy wood)
   - [ ] sub task 1 (eg: Find supplier) #now #pc
   - [ ] subtask 2 (call supplier) #next #phone

If i use dataview on a dashboard to filter #now tasks, if only shows “find supplier” without further context.

TASK
FROM ""
WHERE contains(tags, "#now") AND !completed

So if i want to start trying to add context to that task (“buy wood”), i used this code.

TASK
FROM ""
WHERE contains(tags, "#when/1-now") AND !completed
GROUP BY T.section

Resulting in something like this, showing -(1) instead of “buy wood”:

-(1)
  - [ ] sub task 1 (eg: Find supplier) #now #pc

I was able to add some context (note name and link) using this but it is missing still missing the main task reference:

TASK
FROM ""
WHERE contains(tags, "#now") AND !completed
GROUP BY file.link

I end up having something like, but ir still lacks some direct reference. For now this is my best shot.

Proyect - Build Kitchen Cabinets (link to note)
  - [ ] sub task 1 (eg: Find supplier) #now #pc

I also aproached using tables, but that takes the checkbox of the task out and i mark it as done from my working dashboard.

Can you help me with this? Ideal scenario to avoid using too much screen real estate would be something like this.

In Grouping:

Main task (with link to note)
  - [ ] sub task 1 (eg: Find supplier) #now #pc

In Table it would be the same with table formatting AND checkbox for task.

I dont mind installing more plugins for added functionality but i could not work this out even using AI. We even tried dataviewJS with no success

I have installed dataview 0.5.68
tag wrangler 0.6.4
Tasks 7.19.1
Templater 2.12.1

hi! i assumed your problem is that you need that additional context (e. g. the main task too, along with the actual search result).

i typed these lines in a note:

  • main task
    • task 1 #now

and the query is this:

TASK
FROM #now 

which returned

  • main task
    • task 1 #now

is this the behavior you were looking for?

No, that brings just about everything.
Eg

Note one
Main 1
Sub 1
Sub 2 #now

Main 2
Sub 1

Main 3
Sub 1

Note 2
Main 4
Sub 1

Main 5
Sub 1 #now

It brings
Main 1
Sub 1
Sub 2 #now

Main 2
Sub 1

Main 3
Sub 1

Main 4
Sub 1

Main 5
Sub 1 #now

What i would need is to only bring

Main 1
Sub 2 #now

Main 5
Sub 1 #now

thanks! now, from what i understand, dataview just can’t natively grab a parent task like that - it doesn’t track tasks’ hierarchy, sadly.
i have managed to get a semi-working dataviewjs script - but the checkboxes aren’t rendered and can’t be ticked (if you’d still like to see that script, let me know).
at this point, i’d consider adjusting the workflow to accommodate for this issue.

Given tasks like:

# Main task (eg: buy wood)
   - [ ] sub task 1 (eg: Find supplier) #now #pc
   - [ ] subtask 2 (call supplier) #next #phone

You could try something like:

```dataview
TASK FROM #now
WHERE #now
FLATTEN text + " (" + section + ")" as visual 
```

Untested, but the point is that you’ll pull the given task, and use FLATTEN ... as visual to change the text to display. This should allow you to present the section link of the task, IIRC. Do also remember, that any task query by default has a link back to the definition of the task through clicking on the task text itself.

Alas, it’s true that currently there are not very good options for dealing with parent/subtasks, except through dataviewjs, but it do seem like using visual should meet most of your requirements.