Dataview: How to unknown inline variables and list their values?

I’ve searched documentation, forum, discord and on internet generally and can’t find a similar query anywhere.

What I’m doing:

I structure my daily notes with inline variables like:
“?::”
“!::”
“insight::”
“project::”
Those inline variables are not fixed, I may have everyday a new one, depending of what I’m writing.

What I want to achieve

I want to have a list, sorted by date and variables, with the content of the variable:

“?”
2025-05-09 Content 1
2025-05-10 Content 2

“project”
2025-05-09 Content 3
2025-05-07 Content 4

So the Dataview / Dataviewjs-Query should

  1. look after what kind of inline variables exist
  2. for each variable find the content and put it into a list, for a defined time array (last week)

What are your ideas and suggestions?
Thanks
Gab

I added Dataview: to the topic title. That’s what you are using here, right? It will help focus the conversation.

1 Like

I am not to be qualified as a newbie in Obsidian and have had my fair share of experience of plugins and their documentations, still, – because I was lazy(?) – I went for demo vaults where all building blocks, complete with templates that create the properties to be queried in any way have been made. Then I could go on from there to tweak templates, DV(Js) queries (if in doubt, use free AI to customize stuff), remove functionality I didn’t need, replace plugins with newer, actively maintained substitutes, etc.

If you think this is something that you want to try, read (and follow links from) here:

As for bringing in content of md files, that is trickier, and have to look up forum posts on how to do it with plain DV or better DVJs.

If you put your inline property in a list item as you type, like this:

- project::project info here
- ?::question here

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

- insight::insight here

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

… then you could get this type of output:

… with a query like this:

```dataview
LIST rows.display
FROM "your/folder/path"
FLATTEN file.lists AS L
WHERE contains(L.text, "::")

FLATTEN choice( (startswith(L.text, "[") AND endswith(L.text, "]")) OR (startswith(L.text, "(") AND endswith(L.text, ")")), substring(L.text, 1, length(L.text) - 1), L.text ) AS T

FLATTEN split(T, "::")[0] AS K
FLATTEN split(T, "::")[1] AS V

FLATTEN file.link + " " + V AS display
SORT date(file.name) ASC
GROUP BY K
SORT rows.K ASC
```

Replace your/folder/path with the path to your daily notes folder.

It works when the properties are the way you showed them and also when they’re enclosed in square brackets or parentheses like [project::project info] or (project::project info).

(edit: typos and better screen capture)

2 Likes

Great, it works.
One question:
It only works with items like

- project::project info here

Is there a way to make it work for items without the preceeding “-”, like?

project::project info here

Not with plain Dataview, but probably with DataviewJS. That’s why I said to put the properties in lists. It makes for a quick, straightforward query.

Hopefully someone else can help you with it. I messed up the simple regex check in the query I posted above and switched to choice(startswith( instead. So I’m not anyone’s go-to for that!

Good luck.

Thank you very muchu, your effort brought me a huge step forward!

1 Like