Returning Assigned Tasks containing a link in Dataview

What I’m trying to do

I have a number of tasks and I’m experimenting with assigning a task to a person and then pulling the task back on whether the assigned field equals the person name.

Things I have tried

I started with:

  • #task Test :heavy_plus_sign: 2024-10-25 [assigned::Firstname.surname]
TASK
FROM "TASK FOLDER" AND #task 
WHERE assigned = "Firstname.surname"
  AND !completed 
SORT file.name DESC
GROUP BY section

This pulled back the task I created. However I want the assigned field to also include a link. I created 2 versions of the task. One is the link and the other is a link with an alias:

  • #task Test :heavy_plus_sign: 2024-10-25 [assigned::[[Firstname.surname]]]
  • #task Test :heavy_plus_sign: 2024-10-25 [assigned::[[Workload Firstname.surname|@Firstname.surname]]]

When I used the dataview query below it didn’t work:

TASK
FROM "TASK FOLDER" AND #task 
WHERE contains(assigned, "Firstname.surname")
  AND !completed 
SORT file.name DESC
GROUP BY section

Unfortunately nothing was returned. Do you know why the query didn’t work?

Do the following queries work as you need?

- [ ]  #task Test task 1 ➕2024-10-25 [assigned::[[Firstname.surname]]]
- [ ]  #task Test task 2 ➕2024-10-25 [assigned::[[Workload Firstname.surname|@Firstname.surname]]]

```dataview
TASK
FROM "TASK FOLDER" AND #task 
WHERE assigned = [[Firstname.surname]]
  AND !completed 
SORT file.name DESC
GROUP BY section
```

```dataview
TASK
FROM "TASK FOLDER" AND #task 
WHERE contains(text, "Firstname.surname")
  AND !completed 
SORT file.name DESC
GROUP BY section
```

@anon45210282 interesting. So both queries work but return different tasks.

All 3 variations of tasks that I have created were returned with the second. Assume “text” refers to the text for the whole of the task not just the “assigned” variable? How do you use “contains” on the “assigned” variable?

A separate question, but for data integrity, when you create the task is is possible to get the link to come up with options when you create the assigned field?

1 Like

Hello

Assume “text” refers to the text for the whole of the task not just the “assigned” variable?

Yes, as far as I understand things.

How do you use “contains” on the “assigned” variable?

The following works on the simple link, but not on the alias. I don’t know how to get “contains” to work with the alias.

```dataview
TASK
FROM "TASK FOLDER" AND #task 
WHERE contains(assigned, [[Firstname.surname]])
  AND !completed 
SORT file.name DESC
GROUP BY section
```

A separate question, but for data integrity, when you create the task is is possible to get the link to come up with options when you create the assigned field?

That should happen for links automatically wherever they are created:

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