obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Get current folder

Open julionav opened this issue 4 years ago • 9 comments

First of all, this plugin is AWESOME

I was wondering if there is a way to get the "current folder" in the query

So instead of writting:

task from "1. Projects"

I could write:

task from current_folder

Maybe exposing like the current file path (and more contextual information) could help here

julionav avatar Apr 11 '21 16:04 julionav

This will be possible via this.file.folder once I revamp how the 'FROM' statement works to accept arbitrary variables instead of just hard-coded tags/folders/what-not.

blacksmithgu avatar Apr 13 '21 03:04 blacksmithgu

Just a bump. I'd like to have the ability to use the DataView to produce summaries at the bottom of a document, and that seems to require the rework of the FROM statement to support this.file arguments.

My expected workflow where this applies:

  1. Generate a "Meeting Notes" document from a pre-defined template
  2. Take notes during a meeting, using QuickAdd plugin shortcuts to insert "Decisions" and "Actions" within the notes.
  3. The Dataview blocks originally defined in the Template list the collected set of all "Decisions" and "Actions" in special sections at the end.

So a Template file kind of like this:

# {{title}}
## Attendees
- [ ] 
## Notes

## Decisions
```dataview
TASKS FROM this.file WHERE decision!=Nil
```
## Actions
```dataview
TASKS FROM this.file WHERE assignee!=Nil SORT BY assignee ASC
```

As I take notes I have QuickAdd Capture macros that will insert decisions:

- [ ] [decision::] {{VALUE:Decision}}

And action items:

- [ ] [due::{{VDATE:due,YYYY-MM-DD}}] [assignee::{{VALUE:assignee}}] action:: {{VALUE:action}}

So I trigger creation of a new "Meeting Notes" file populated from the template, then fill in Attendees and start taking notes. As I take notes, I trigger Capture macros for decisions and action items embedded in the notes body. When I'm done, the end of the notes have a copy of the summarized decisions and action items as well.

mtalexan avatar Feb 01 '22 00:02 mtalexan

You can cheat for now via a WHERE clause:

TASKS WHERE file.path = this.file.path AND decision

blacksmithgu avatar Feb 14 '22 23:02 blacksmithgu

This has been a common enough approach and needs a mention in the docs. Do we plan to support this in the QL?

AB1908 avatar Oct 19 '22 09:10 AB1908

Yes, I'm still looking at dynamic sources for the QL.

blacksmithgu avatar Oct 19 '22 21:10 blacksmithgu

Just bumping this, I'd also love this feature!

adzcai avatar Nov 02 '22 02:11 adzcai

This has been a common enough approach and needs a mention in the docs. Do we plan to support this in the QL?

How should we document this? As a question in the FAQ, a hint on the FROM data command, both, something different?

s-blu avatar Dec 02 '22 18:12 s-blu

I think both. I wish I had the skills to pr this in so we could avoid the doc headache in the first place haha.

AB1908 avatar Dec 03 '22 11:12 AB1908

What's the status of this? Anything I could do to help?

nikodemus avatar Sep 02 '24 09:09 nikodemus

In current version of dataview you can indeed use this.file.folder, so @nikodemus you should be able to do stuff like: WHERE file.folder = this.file.folder to limit to the current folder.

You can't use a FROM ... syntax, but the above works nicely in my experience.

holroy avatar Dec 28 '24 16:12 holroy