Dataview Inline Fields in Tasks not Showing Up

Things I have tried

I have attempted reading through the documentation, using [ ] brackets around the items, using ( ) brackets around the items, and searching through the forums here. I did fine one closely relevant topic, but I’m not sure I understand the required steps to perform this query properly.

What I’m trying to do

Trying to create an inline data field inside of a todo/task item. Given the following setup, you’ll see that items without the task entry at the beginning of the line, are not showing in the following table afterward.

Bug:: [POC-2795](
[Bug:: [POC-2796](]
- [ ] Bug:: [POC-2797](
- [ ] (Bug:: [POC-2798](

TABLE WITHOUT ID as "Meeting",Date,Employer,FR,Bug
WHERE file = this.file

Given this query with this data on the page, the resulting Dataview looks like this:

Items 95 and 96 are showing up, but items 97 and 98 are not. I can’t for the life of me figure out how I can get these to work properly per the documentation suggestion of using the bracket notation.

If you want to embed metadata inside sentences, or multiple fields on the same line, you can use the bracket syntax:

I would rate this a [rating:: 9]! It was [mood:: acceptable].

There is also the alternative parenthesis syntax, which is functionally similar to brackets but hides the key when rendered in Reader mode:

This will not show the (very long key:: key).

In my situation, I don’t care about the ability to mark the items complete. In the real use case, they are often an Action Item for me to take, that usually involves creating something somewhere - but I want to actually track these items with these tags, as they’re more easily found later when keeping up on activity with the data view query that I use.

This example is invalid (because inside tasks or list all inline fields need to be placed inside brackets)

Now about the general issue. Generic inline fields are data at page level (in your case, a field you can target as Bug in your query). But inline fields inside the tasks (or lists) text are data in that specific level: a field inside the tasks or lists level. In your case, something like file.tasks.Bug.

To take in consideration both levels (page level and tasks level) you’ll face some challenges.
To start you can try this:

TABLE WITHOUT ID AS "Meeting", Bug, file.tasks.Bug AS "Bug in task"
WHERE file.path = this.file.path

But because file.tasks is, by default, an array, then you’ll see many empty results related with other tasks (without the Bug field) in your note.

Without more complex commands (flatten, group, etc.), you can try filter the file.tasks.Bug:

TABLE WITHOUT ID AS "Meeting", Bug, filter(file.tasks, (t) => t.Bug).Bug AS TBugs
WHERE file.path = this.file.path

Finally, you can also join Bug and file.tasks.Bug

TABLE WITHOUT ID AS "Meeting", list(Bug, filter(file.tasks, (t) => t.Bug).Bug) AS Bugs
WHERE file.path = this.file.path

But if Bug = 0 or filter(file.tasks, (t) => t.Bug).Bug = 0, you’ll see an ugly empty space.


Awesome! Thank you for the detailed answer. This helps me understand not only HOW to solve the issue, but WHY it happens as well. I had started to understand a bit of that I believe from your other answer that was linked, but I hadn’t grasped the full layout and if it was as simple as forming a statement like file.tasks and looking for Bugs field on them.

One followup for my further learning on this type of handling - is there documentation on what the (t) => t.bug is doing? Should I just be checking out the “filter” documentation on dataview help pages? I didn’t get it right off the bat, but perhaps I just need to revisit that and some further googling.

Appreciate your response again, and the speed at which you solved my problem!

EDIT - As I’ve come to institute this, I do see the issue you pointed out about ugly space. Without having you brain dump your knowledge again, would I need to use a combination of Group and Flatten you said to be able to achieve this without the ugly space? I see I’m entering the rabbit hole of advanced querying in Obsidian - which will be bountiful I’m sure, but will likely start with frustration and time learning.

1 Like

Using flatten and group by is one of the way. But in this case, to avoid these commands (avoiding the «rabbit hole»), try with the technique of nested filters In replace of list(Bug, filter(file.tasks, (t) => t.Bug).Bug)):

filter(list(Bug, filter(file.tasks, (t) => t.Bug).Bug), (b) => b) AS Bugs

About the (t) => t.bug thing, well, this is related with javascript (I’m not coder, so, my knowledge is more “functional” than technical). In this case - filter(file.tasks, (t) => t.Bug) - it works in this way: filter what? file.tasks is an array by default; (t) works as an alias that replace file.tasks; with => we say “apply the defined rule to each value inside the array file.tasks”; with t.Bug the filter command select only the cases (inside file.tasks) that have the Bug field. (not a good explanation… :slight_smile: )

1 Like

Just to add on to @mnvwvnm 's excellent explanations:
(args) => expression is known as an “arrow function” and exists in several languages besides Javascript. You may be able to get additional explanations searching that term.

In the case of filter(file.tasks, (t) => t.Bug) overall, we are checking each element of the list file.tasks. The second arg of filter needs to be a function that takes as input a single list element and outputs true/false. The arrow function notation is a way to concisely write down that function. (t) gives a name to the single list element that is input. => is the syntax notation for saying “ok that was the input, now here comes the output”. t.Bug is the output. It makes use of a Javascript trick that says anything can be interpreted as true/false. If there is no Bug field in the particular list element t, it will be false. Quirks about what values are considered “truthy” or “false-y” in Javascript explain the weirdness with 0/“”/etc. But basically the arrow function allows a concise way of writing down this function to check the list element.

Another arrow function example is map. Same idea, doing something for all the list elements, but this time the output does not have to be true/false.
Going to use this to show another useful thing you can do with arrow functions, which is when you know the structure of the args in the ( ) you can give names to the internal bits. Contrived example here: let’s say you had some list where each element looks like ["words describing work", number-of-minutes-spent]. myWork:: ["task1", 60],["task2",90],["ugh this chore", 45] and you want that second value in hours. map(myWork, ([desc, mins]) => [desc, mins/60])

Hope these examples help you as you learn more!

1 Like

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