obsidian-dataview
obsidian-dataview copied to clipboard
Another idea... Templated queries
Concept syntax:
```dataview(template="my-query", args=["arg1", "val1", "arg2", "[[val2]]", ...])
```
Config screen then has a section to select a template folder. template
is the name of the note in the template folder. That note can contain anything (for descriptive comments, etc) but only the actual query itself is extracted from the template at runtime and executed in the target note. Using named params instead of positional params keeps the calling syntax extensible.
There are certainly other ways to do it as well, this is just a thought.
Yeah, seems useful for common queries like "show all the daily notes for month <X>" or "create a generic index over files tagged #thing". Will see what I can do.
Yep! This would be especially powerful in combination with your existing idea to have a this
variable that can pull data from the note containing the query.
Thanks, you are awesome! :heart:
Hey there, what was the use case for this?
Hi @AB1908 I'm not OP, but I'll provide a few use cases based on my usage.
There are a few queries I include in all notes of a certain type. For instance, contact notes contain queries to get all the projects a person is a part of and which meetings they've attended. If I could reference a named query in my contacts note template, all current and future contact notes would contain the latest query when I make changes (DRY). Writing regex find/replace to update all query instances is painful at the moment and needlessly updates the file modification time of the notes.
Not something I'm using yet, but the inline syntax seems really powerful. Its compact nature I think would lend itself well to some sort of "stored procedure" as well.
This seems doable via dv.view()
at the moment but it's a decent idea.