Query Task on outlink field?

Hello,

What I’m trying to do

I would like to querying tasks binded with specific type note (Goal).

My tasks can be like this :

  • [ ] My task fullfilling a [[Goal1]]
  • [ ] Other task with [[Note]] as ref
  • [ ] task 3 in line with [[Goal2]]

All my notes have a field note: where i can specify the type (goal, Daily, etc…)

In my exemple i would like to filter the tasks with outlink note with subfield type goal only :

  • [ ] My task fullfilling a [[Goal1]]
  • [ ] task 3 in line with [[Goal2]]

Something like this :

TASK
WHERE 
	!completed AND contains(task.oulinks.note , "goal")
   
GROUP BY file.link

I tried many things, but don’t know if it’s possible or need to use dataviewJS

Thanks !

1 Like

The query below works in my tests but isn’t exclusive to the outlinks. Any use?

```dataview
TASK
WHERE 
	!completed
AND
	contains(text, "Goal")
GROUP BY 
	file.link
```

The thing is my goal notes don’t have the word goal in title it could be thing like this

  • [ ] My TaskX for [[Conguering the world]] !

I can’t get it to work on the outlinks. Hope someone else can help. :crossed_fingers:

1 Like

I think i found the solution.
I posted it bellow maybe it could be helpfull for someone.

TASK
	
FLATTEN
	outlinks AS outlink
WHERE 
	!completed and
	outlink.note = "goal"
	
GROUP BY file.link

2 Likes

Can’t get your query to work. Don’t know why. :thinking:

Great if it does work for you. :smiley:

This does, I think:

```dataview
TASK
WHERE 
	contains(outlinks, [[Goal1]])
OR
	contains(outlinks, [[Goal2]])
AND
	!completed
GROUP BY 
	file.link
```

3 Likes

Hi could you show me your [[Goal1] note ?
You need to add it a Yaml with note field for this to work
like this

---
note: goal
---
or this
note:: goal

1 Like

Ah, with the added YAML, it works.

Clever!!

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