Help in querying nested inline fields with Dataview for idea tracking

What I’m trying to do

Hello everyone,

I am trying to use Obsidian with the Dataview plugin to manage and track ideas in my daily notes, with each idea annotated using inline fields with double colon notation. Here is an example of how I structure each idea with associated parameters like time of creation and status:

  • idea:: An idea

    • time:: 2024-05-12T14:35
    • status:: to_explore
  • idea:: Another idea

    • time:: 2024-05-12T15:20
    • status:: explored

Challenges:

Querying: I need a way to query ideas marked as “to_explore” and sort them by their time. The query should be able to extract each idea along with its nested attributes. However, I couldn’t group each idea with its corresponding time and status correctly.

Things I have tried

This was my approach:

TABLE WITHOUT ID
    idea,
    time,
    status
FROM "Journal/Daily"
FLATTEN file.lists as ideas
WHERE ideas.status = "to_explore"
SORT ideas.time

This query incorrectly treats all entries as separate, displaying all ideas for each status “to_explore” without linking them.

  1. Other approaches that could work, but are not ideal:

Frontmatter: Using frontmatter isn’t ideal because the number of ideas can vary each day.

Separate notes for each idea: Keeping each idea in a separate note would quickly clutter the vault, and most of them would probably be empty, containing only the fronmatter.

Could anyone suggest how to adjust this query or recommend a different approach to structuring the inline parameters so that each idea can be linked (related, nested, connected) with its respective time and status in the query output?

Any ideas, examples, or alternative approaches would be great!

Thanks!

I’m trying to solve this exact problem too. No luck so far! Have messed around with a lot of grouping and flattening and various other ways of querying the data, but I can’t seem to get Dataview to understand nesting. I wonder if it’s even possible.

Found a partial solution, based on info here. Modifying your attempt above, this should make a table with columns for idea, time and status, and only include rows with status “to_explore”:

TABLE WITHOUT ID
    ideas.idea,
    ideas.subtasks.time[0],
    ideas.subtasks.status[1]
FROM "Journal/Daily"
FLATTEN file.lists as ideas
WHERE contains(ideas.subtasks.status, "to_explore")
SORT ideas.time

Less than ideal is that your subtasks must always be in the same order. Try it without the [0] or [1] and you’ll see that the .subtasks metadata is trying to put a list in the column, so we have to specify which item from the list we want.

It’s doable to do this for a structure like yours, and just a little time ago I posted the thread below depicting how you could pick fields from sublists:

Converted to the OP’s case it’ll look something like:

```dataview
TABLE WITHOUT ID idea, time, status
FROM "Journal/Daily"
WHERE file.lists.idea
FLATTEN file.lists as item

WHERE item.idea
FLATTEN item.idea as idea
FLATTEN default(nonnull(item.children.time)[0], "") as time
FLATTEN default(nonnull(item.children.status)[0], "") as status

WHERE status = "to_explore"
SORT time
```

I might be a little excessive in limiting the query using both FROM and WHERE file.lists.idea, but in my experience it’s better to limit down the set your working with before doing a somewhat expensive FLATTEN file.lists as item which could explode the row count quite a bit.

After that I do the WHERE item.idea to focus on only the idea bullet item, and then I extract and re-assign the values of the children of that item for later query work.