Updating and referring to global variables

Things I have tried

I have set up a file called “Global” in a root directory called “global”. I have defined my global values such as “lastMedium” in the front matter. I can now manually update them (meaning: adding 1 for each new note) via databaseTable with something like:

```databaseTable
sources:
  - type: directory
    path: global
fields:
  - name: lastMedium
    type: number

I can then refer to this variable via dataview with e.g.:

lastmedium:: `$=dv.page("global/Global").lastMedium`
lastmediumName:: `="Hallo, " + this.lastmedium`

So far, so good.

What I’m trying to do

I have different sets of files with sequential IDs which do not match their filenames. I want to set up global variables that should be automatically referred to and incremented when creating a new note. Some of these variables must be calculated depending on values (such as title, or author name) in the note.

What is not working

The logical next step would be to have

  • a template (via Templater?) that
    1. updates my global file (= adds 1 to lastMedium) and
    2. creates a new note with referrals to the current lastMedium, or/and
  • a button that
    1. updates the global file,
    2. creates a new note or
    3. updates the current note.

How can I achieve this?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.