Easily use Bases formulas and view file properties in any note

I found a super easy way to use formulas and view file properties—both enabled by Bases—for any note that is currently in focus:

All you need to do is to create a base with a filter that outputs the current note only:

file.path == this.file.path

You could then embed that base into note:

Or drag it to a sidebar:

The base will then always reflect the note that’s currently in focus.

Though it might be annoying to have to scroll horizontally if you add lots of properties to the base. Related feature request:

A couple of uses for this that I’ve come up with is to view the modified time file property and to calculate mins to read based on the word count property.

The Virtual Content plugin does something similar—without having to modify the note.

I’d love to hear what uses you’ve come up for this :raising_hands:

Inspired by a post from kepano.

Also, I made a feature request for dynamic properties in YAML:

8 Likes

Very good idea! With the card view it’s more pleasant to see than the default table.

1 Like

Here is what I do for this:

  1. I set the filter to file.folder == "path/to/folder" for all views.
  2. I set the filter to file == this.file for the EMBEDDED view.
  3. The EMBEDDED view only includes the formula properties that the individual note doesn’t have.
  4. Use ![[X.base#EMBEDDED]] in your note. In this case, I set the EMBEDDED view to table view.
  5. Drag base file to the side panel. In this case, I set the EMBEDDED view as to list view so that the properties are displayed vertically.

***

If you don’t want to hard-code any folders or paths in the filters field, you can set your all-view-filters like this: (assuming the base file is placed in the same folder as the notes it manages)

filters:  # for all views
  or:
    - and:
      - this.file.ext == "base"  # if this file is a base file
      - file.folder == this.file.folder  # include all notes in the same folder
      - file.ext == "md"  # only show .md files.
    - and:
      - this.file.ext == "md"  # if this file is a note
      - file == this.file  # show only this note

The best part is that every view in this base file can be used both embedded and standalone.

1 Like