retrieve variables from an external note in Obsidian Templater and insert/use them in the template of the target file.

What I’m trying to do

I’ve only recently started to get to grips with Templater and I’m starting to despair of a problem.
For an automated workflow, it would be helpful for me if I could retrieve variables from an external note in Obsidian Templater and insert/use them in the template of the target file.
How on earth can I make this happen?

Things I have tried

I’m afraid this can only be implemented by an external script. As far as I can see, Templater itself does not provide a function for this.

What do you define as variables in another a file? How are they written in the other file?

Specifically, it would be about reading yaml metadata of an external note.
This metadata should then also be used as metadata in the newly generated note.

Get Dataview inline field from different file using Templater

Why use detaview metadata instead of yaml frontmatter

dataview metadata is basically key:: value, like Topic:: Apple.
The difference/advantage compared to yaml frontmatter for me is you can add link to it. Dataview could recogize these links.
(e.g. Topic:: [[Apple]], or NPC:: [[Ann]], [[Ben]], [[Cel]])
And therefore you can navigate through different links pretty easily.

Thank you very much! That is in any case also an interesting variant.
However, the problem probably remains that the variants are not hereditary (?)

In my case it is about the automatsiering of a storyboard:
There are notes for assets and notes for scenes.
The notes should inherit single metadata from the parent instance Notes.

It should be possible to make a Templater template so that if you trigger it the correct way it detects which file it was triggered from, and then use the execution command variant of the template to call const p = dv.page(parentFile).

Once you’ve gotten so far, you would be able to access the fields defined in that page using p["field-name"] or p.fieldname within that command block in the template.

But I’ve been having a few issues related to reliably find that original/parent file from where you triggered the creation of the new file. So it does depend a little on how your intended workflow is. In any case, this will not keep track of any changes done in the parent file, it’ll just copy it on creation of the new files.

If you’re looking for automatically updates on the metadata of your parent file, I think you’re fresh out of luck. At least if you in addition need to use those imported metadata for other queries. In such a scenario, it would be better to include a parent link in all child notes, and then use that parent link (and its metadata directly) in related queries.

Thank you very much for your answer.
The whole thing is probably really not a no-brainer.
The source note is not dynamic. Likewise, the variables of the target notes will be static.

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